-
Notifications
You must be signed in to change notification settings - Fork 65
Support scoped AWS configurations #729
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
Conversation
kleinschmidt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor of the support for with_aws_config and scoped values. I'm not so sure about deprecating and eventually removing global_aws_config. On the "pro" side, I think that removing it will encourage better practices around e.g. setting any global configuration via environment variables outside of code or using the scoped values. On the "con" side, I strongly suspect that for script usage, people will "learn" to do something like ENV["AWS_PROFILE"] = "my-local-profile-hehe" rather than constructing a config from a role directly. Unless we're willing to go all the way and totally remove the global fallback option, it seems a net loss to me to remove the ability of users to set that global/fallback. Forcing folks to put their actual code in a function body (either anonymous do block or otherwise) is juuust annoying enough that I can see people being inclined to work around it by setting the global fallback in some other way, which I don't think is really the goal of this PR.
| function with_aws_config(f, config::AbstractAWSConfig) | ||
| return @with _SCOPED_AWS_CONFIG => config begin | ||
| f() | ||
| end | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a method that passes kwargs to AwsConfig like global_aws_config does?
| function with_aws_config(f, config::AbstractAWSConfig) | |
| return @with _SCOPED_AWS_CONFIG => config begin | |
| f() | |
| end | |
| end | |
| function with_aws_config(f, config::AbstractAWSConfig) | |
| return @with _SCOPED_AWS_CONFIG => config begin | |
| f() | |
| end | |
| end | |
| with_aws_config(f; kwargs...) = with_aws_config(f, AwsConfig(; kwargs...)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm opposed to this as I think constructing an AWSConfig to pass in isn't much more to write and deprecating the kwarg version of global_aws_config was a pain. Additionally, this makes alternate AbstractAWSConfig implementations feel less like second class citizens.
Hmmm, I don't love the global fallback myself and I ended up adding it for two reasons:
Maybe the half-step to do at this point is to not deprecate |
|
I'll push an implementation tomorrow but the plan at this moment is to:
|
|
I ended up using the name |
kleinschmidt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with this deprecation pathway. Just a few typos/doc improvements to suggest, but you can take or leave them.
Co-authored-by: Dave Kleinschmidt <[email protected]>
Addresses part of: #717.
Deprecates
global_aws_configin favor of usingwith_aws_configfor scoped setting of an AWS configuration andcurrent_aws_configfor accessing. The newwith_aws_configis thread safe unlike the oldglobal_aws_config. What this doesn't do is eliminate the ability to set the AWS configuration on a per-API call basis which is the controversial bit of #717.Reviewers note: The changes in
src/services/*just changeglobal_aws_config()tocurrent_aws_config().Supersedes #718 which the GitHub UI is having a hard time with due to the numerous formatting suggestions which were made on that PR.
TODO:
global_aws_config