lib/opsicle/config.rb in opsicle-2.2.0 vs lib/opsicle/config.rb in opsicle-2.2.1
- old
+ new
@@ -18,10 +18,14 @@
def opsworks_config
@opsworks_config ||= load_config(OPSICLE_CONFIG_PATH)
end
+ def opsworks_region
+ opsworks_config[:region] || "us-east-1"
+ end
+
def configure_aws_environment!(environment)
@environment = environment.to_sym
end
def load_config(file)
@@ -55,15 +59,16 @@
end
def authenticate_with_credentials
profile_name = opsworks_config[:profile_name] || @environment.to_s
credentials = Aws::SharedCredentials.new(profile_name: profile_name)
+ region = opsworks_region
unless credentials.set?
abort('Opsicle can no longer authenticate through your ~/.fog file. Please run `opsicle legacy-credential-converter` before proceeding.')
end
- Aws.config.update({region: 'us-east-1', credentials: credentials})
+ Aws.config.update({region: region, credentials: credentials})
iam = Aws::IAM::Client.new
# this will be an array of 0 or 1 because iam.list_mfa_devices.mfa_devices will only return 0 or 1 device per user;
# if user doesn't have MFA enabled, then this loop won't even execute