-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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 secrets taking precedence over provider configuration #24547
Comments
I have the same issue. I only need to use the |
😱 We're declaring different providers using local profiles but they are ignored when environment variables are set.
@gdavison any idea what's the effort to fix this? |
Are you still seeing this with the latest version of the provider? If so, can you try running this with the environment variable We're looking for lines containing |
@gdavison, you're right. It works with the latest version of the provider.
I just need to update all my modules and then change the provider version. Thanks. I guess the issue with |
@macmiranda, the Since this is resolved in the latest provider, I'm going to close the issue. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Terraform CLI and Terraform AWS Provider Version
Terraform 1.1.9
AWS Provider ~> 4.12.0
Affected Resource(s)
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
providers.tf
main.tf
Expected Behavior
Terraform should use the default provider when creating the resouce "my-bucket-a" as there is no alias specified in the block. As the resource "my-bucket-b" specifies an alias for the provider with the assume_role_with_web_identity option, it should try to use that provider.
Actual Behavior
Every resource is being created with the credentials of the default provider with no credentials specified.
Steps to Reproduce
terraform init
terraform plan
terraform apply
Important Factoids
I am using github actions to deploy this code hence, it seems reasonable to use GitHub OIDC to autheticate to AWS. For the default provider, the authentication is made by using the following action:
aws-actions/configure-aws-credentials@v1
The above action, authenticate successfully to AWS and exports the short-lived token as environment variables for the runner and then the default provider use it to run.
The thing is that the second provider is also using the above credentials which in my understanding is wrong because it does not respect the order stated in the terraform docs.
I can be missing something here as well! I am adding the references I guess are related/going to help in this investigation.
Thanks in advance and please tell me if you need any further information.
References
The text was updated successfully, but these errors were encountered: