Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[STS]Support opt-in regional STS endpoint #2090

Merged
merged 11 commits into from Oct 23, 2019
Merged

[STS]Support opt-in regional STS endpoint #2090

merged 11 commits into from Oct 23, 2019

Conversation

cjyclaire
Copy link
Contributor

@cjyclaire cjyclaire commented Jul 23, 2019

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

WIP

This PR support opt-in STS regional endpoints by setting sts_regional_endpoints: 'regional' at client or from ENV AWS_STS_REGIONAL_ENDPOINTS or sts_regional_endpoints in shared config

By default, SDK set sts_regional_endpoints: 'legacy', previous non-regionalized regions will stay with global endpoints

@cjyclaire
Copy link
Contributor Author

cc @jasdel & @howardlopez for review :D

Copy link

@howardlopez howardlopez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but should there be a test that verifies the sts_regional_endpoints value is taken from the env source first over the config file?

Also, does this need a changelog?

@cjyclaire
Copy link
Contributor Author

@howardlopez Added tests and changelog ;)

@cjyclaire cjyclaire merged commit b74930e into master Oct 23, 2019
@uthark
Copy link
Contributor

uthark commented Oct 23, 2019

Hi! This PR breaks for us.

ArgumentError: wrong number of arguments (given 3, expected 2)
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-partitions-1.162.0/lib/aws-partitions/endpoint_provider.rb:94:in `resolve'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/aws-sdk-core/plugins/regional_endpoint.rb:39:in `block in <class:RegionalEndpoint>'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:70:in `call'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:213:in `block in resolve_defaults'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:57:in `each'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:57:in `each'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:212:in `resolve_defaults'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:205:in `value_at'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:189:in `block in resolve'
/opt/chef/embedded/lib/ruby/2.3.0/set.rb:306:in `each_key'
/opt/chef/embedded/lib/ruby/2.3.0/set.rb:306:in `each'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:189:in `resolve'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:177:in `apply_defaults'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:150:in `build!'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/base.rb:62:in `build_config'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/base.rb:19:in `initialize'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-ec2-1.84.0/lib/aws-sdk-ec2/client.rb:252:in `initialize'
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/base.rb:99:in `new'

@boveus
Copy link

boveus commented Oct 23, 2019

We are experiencing the same issue.

@cjyclaire
Copy link
Contributor Author

cjyclaire commented Oct 23, 2019

taking a look, mind let me know gems and versions you are using? @uthark @boveus

@boveus
Copy link

boveus commented Oct 23, 2019

Our error seems related to the aws-sdk-cloudfront gem. We are calling

Aws::CloudFront::Client
    .new(credentials: credentials, region: 'us-east-1')

It looks like CloudFront was updated with the latest release of aws-sdk-core:

aws-sdk-cloudfront (1.5.0)
      aws-sdk-core (~> 3)
      aws-sigv4 (~> 1.0)

During our application deployment. That results in the following stack trace:

�[1mTraceback�[m (most recent call last):

	20: from ./deployment/scripts/cdn_setup.rb:50:in `<main>'

	19: from ./deployment/scripts/cdn_setup.rb:33:in `invalidate_distribution!'

	18: from ./deployment/scripts/cdn_setup.rb:25:in `cloudfront_client'

	17: from /app/vendor/ruby-2.6.2/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/base.rb:99:in `new'

	16: from /app/vendor/bundle/ruby/2.6.0/gems/aws-sdk-cloudfront-1.5.0/lib/aws-sdk-cloudfront/client.rb:154:in `initialize'

	15: from /app/vendor/ruby-2.6.2/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/base.rb:19:in `initialize'

	14: from /app/vendor/ruby-2.6.2/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/base.rb:62:in `build_config'

	13: from /app/vendor/ruby-2.6.2/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:150:in `build!'

	12: from /app/vendor/ruby-2.6.2/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:177:in `apply_defaults'

	11: from /app/vendor/ruby-2.6.2/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:189:in `resolve'

	10: from /app/vendor/ruby-2.6.2/lib/ruby/2.6.0/set.rb:338:in `each'

	 9: from /app/vendor/ruby-2.6.2/lib/ruby/2.6.0/set.rb:338:in `each_key'

	 8: from /app/vendor/ruby-2.6.2/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:189:in `block in resolve'

	 7: from /app/vendor/ruby-2.6.2/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:205:in `value_at'

	 6: from /app/vendor/ruby-2.6.2/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:212:in `resolve_defaults'

	 5: from /app/vendor/ruby-2.6.2/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:57:in `each'

	 4: from /app/vendor/ruby-2.6.2/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:57:in `each'

	 3: from /app/vendor/ruby-2.6.2/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:213:in `block in resolve_defaults'

	 2: from /app/vendor/ruby-2.6.2/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.71.0/lib/seahorse/client/configuration.rb:70:in `call'

	 1: from /app/vendor/ruby-2.6.2/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.71.0/lib/aws-sdk-core/plugins/regional_endpoint.rb:39:in `block in <class:RegionalEndpoint>'

/app/vendor/bundle/ruby/2.6.0/gems/aws-partitions-1.99.0/lib/aws-partitions/endpoint_provider.rb:94:in `resolve': �[1mwrong number of arguments (given 3, expected 2) (�[1;4mArgumentError�[m�[1m)�[m

@cjyclaire
Copy link
Contributor Author

cjyclaire commented Oct 23, 2019

From your log, looks like you are on an outdated partition gem version, mind update to https://rubygems.org/gems/aws-partitions/versions/1.228.0 and let me know whether it works?

@uthark
Copy link
Contributor

uthark commented Oct 23, 2019

@cjyclaire Already testing it.
tests and integration tests were succesful after upgrade.

@boveus
Copy link

boveus commented Oct 23, 2019

@cjyclaire Testing it now.

@cjyclaire
Copy link
Contributor Author

Thanks again for reporting! if confirming the new version has fixed the issue, I'll update core gemspec to make sure that version is a minimum requirement

@boveus
Copy link

boveus commented Oct 24, 2019

Sorry for the delay - we had to make a few other changes in addition to the fix for this one. We are good to go after upgrading that dependency. Thanks for the quick response, @cjyclaire!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants