-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Allow AssumeRole with WebIdentity in provider's configuration #22907
Comments
Thanks for creating this issue, @mwieczorek. Technically, our guidelines suggest that there should be separate |
Thanks @gdavison for the feedback. |
Hi @gdavison |
This functionality has been released in v4.12.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
This looks really nice! @mwieczorek have you ever managed to use two different IAM roles using GitHub OIDC? I have openned another issue explaining a bit more what I am trying to do here: #24547 |
hi @Lincon-Freitas
I get |
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
Description
I'd like to propose better support for AssumeRoleWithWebIdentity in provider configuration.
Context
Recent changes in Github Actions allow using GHA issued JWT token to access AWS (using AssumeRoleWithWebIdentity). I'd like to be able to use JWT to configure provider (or rather multiple providers) and authenticate using AssumeRoleWithWebIdentity.
Currently, it is possible to leave
assume_role
block empty and use standard environment variablesAWS_ROLE_ARN
/AWS_WEB_IDENTITY_TOKEN_FILE
and access AWS this way. But this solution won't work if we'd like to use two or more provider configurations in one Terraform plan but with different roles to assume. (f.e. we want to create and accept VPC peering in one TF plan, or setup Route53 hosted zone delegation to another account, etc.)Proposed solution
Extend provider's configuration, in particular
assume_role
block, by addingweb_identity_token
argument. Example:If
web_identity_token
is empty, the provider will behave as it does right now.In case
web_identity_token
is not empty, the provider will use AssumeRoleWithWebIdentity (instead ofAssumeRole
) to authenticate, in this case, no AWS credentials are required.Additional notes
As an alternative solution, we could add a new block like
assume_role_with_webidentity
to the provider's configuration as not all arguments inassume_role
are supported inAssumeRoleWithWebIdentity
. I'd prefer to reuse the existing block and add validation to exclude some of the arguments whenweb_identity_token
is passed.I looked into the code (if possible/desired I could prepare a PR) and I understand that it will be required to extend https://github.com/hashicorp/aws-sdk-go-base. I plan to open an issue there too when I'll get feedback for this issue.
References
The text was updated successfully, but these errors were encountered: