-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
aws/credentials/ec2rolecreds: zero-value EC2RoleProvider is not safe #452
Comments
provider/aws: temporary fix for aws/aws-sdk-go#452
Hi @rjeczalik thanks for reporting this documentation issue, and suggested change. Adding a default
So we wouldn't be able to create a default We could add something like the following to the func EC2MetadataClient(...) *ec2metadata.EC2Metadata {} Calling How would this work for your use case? |
…s not provide one Fixes aws#452.
@jasdel I tried adding
Then I tried adding Do we have any other options? If not, I'm going to send PR against terraform instead. |
@rjeczalik thanks for trying that out. I don't think we'll be able to provide a default instance of the ec2metadata client for the ec2rolecreds package automatically, due to the circular references. I think the SDK's package layout will require users to pass a EC2Metadata client instance to EC2RoleProvider explicitly. We could add a default EC2Metadata instance to the defaults package, but I'm not sure if there is much benefit here over creating your own instance since it would need to be manually passed to EC2RoleProvider. |
@jasdel I agree, thanks for helping me out :) |
@jasdel Oh I need to be faster next time, wanted to do the same :D |
provider/aws: fix for aws/aws-sdk-go#452
It seems that some formerly optional arguments are now required in the latest aws-sdk-go, see e.g. aws/aws-sdk-go#452.
use aws.Config{}
It seems that some formerly optional arguments are now required in the latest aws-sdk-go, see e.g. aws/aws-sdk-go#452.
The inline doc for ChainProvider says that it's safe to use zero-value of
ec2rolecreds.EC2RoleProvider
, however the doc for the latter says the Client field is required (bonus: the custom client example is outdated).The above causes the following code to panic:
with
Caused by calling NewRequest on a nil *client.Client.
The above example comes from real projects, e.g. terraform.
Now how to fix this - question: what about making zero-value of
ec2rolecreds.EC2RoleProvider
usable? By adding:And changing
m.Client
tom.client()
here.This way we change aws-sdk-go only, not requiring changes to any other projects that might got that wrong.
What do you think?
The text was updated successfully, but these errors were encountered: