bazaarvoice / cloudformation-ruby-dsl

Ruby DSL for creating Cloudformation templates
Apache License 2.0
210 stars 76 forks source link

Credentials regression error in 1.2.3 #98

Closed stevenringo closed 7 years ago

stevenringo commented 7 years ago

When using:

./cloudformation/policies.rb delete my_test_stack

The following error occurs when using 1.2.3

.../gems/aws-sdk-core-2.5.8/lib/aws-sdk-core/plugins/request_signer.rb:100:in `require_credentials': unable to sign request without credentials set (Aws::Errors::MissingCredentialsError)
...
...
from .../gems/cloudformation-ruby-dsl-1.2.3/lib/cloudformation-ruby-dsl/cfntemplate.rb:305:in `cfn'
from .../gems/cloudformation-ruby-dsl-1.2.3/lib/cloudformation-ruby-dsl/cfntemplate.rb:564:in `exec!'

This worked fine in 1.2.1.

It does of course work if you execute this with the --profile and --region switches.

Its not clear from the change why the environment variables capability was removed:

# Following line can be uncommented only when Amazon will provide the stable version of this functionality.
# Aws.config[:credentials] = Aws::SharedCredentials.new(profile_name: args[:aws_profile]) unless args[:aws_profile].nil?

What was unstable? AWS have released a number of new versions of the Ruby SDK since this change was made. Without knowing the nature of the issue, I can't check this. Would be happy to provide a PR once I have some more information.

Thanks

temujin9 commented 7 years ago

The code just above the commented out code does what we expected that code to do, just more verbosely. I have tested both with and without --profile, on the example, and it appears to work as advertised on 1.2.6 and 1.3.2. Can you verify the failure still exists?

temujin9 commented 7 years ago

@stevenringo I have seen no repeat of this issue, and no further notice that it's ongoing in current versions. I'm closing this for now: we can reopen it if you see further repetition.