-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Provider block assume_role correctly assumes role for init, but not for plan #17352
Comments
@josuevalverde12 wanna give this a try with version 3.25.0 of the provider? .26 landed an update to the AWS SDK that had some changes to how credentials get resolved. |
Hey @sidewinder12s, thanks for the reply. I gave it a try with |
I think provider auth is purely in the provider. If you were having issues with the S3 state backend that'd be closer to Terraform version from my experience, but I haven't used the assume_role features of the provider before either. Was just guessing since I ran into a bug in the updated SDK included in 3.26. |
Bump. Can anyone replicate? Still encountering this issue. |
I believe this to be the same issue as #17353 (or at least related). |
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you! |
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
Affected Resource(s)
Terraform aws provider block:
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
If I run Terraform with role
"arn:aws:iam::AAAAAAA:role/Role_A"
that has the correct cross-account permissions to assume the required role"arn:aws:iam::BBBBBBBB:role/Role_B"
, theinit
succeeds but theplan
fails. The plan ends up reverting back to using the previously assumed"arn:aws:iam::AAAAAAA:role/Role_A"
. This terraform modifies resources in accountBBBBBBBB
, which also contains the state file S3 bucket.I have verified that running my Terraform configuration with
Role_B
ends in a successful init, plan, apply.Expected Behavior
plan
succeeds after successfulinit
, usingRole_B
notRole_A
.Actual Behavior
plan
fails with AWSAccessDenied
errors, sayingRole_A
does not have permissions to modify resource in accountBBBBBBBB
Steps to Reproduce
"arn:aws:iam::AAAAAAA:role/Role_A"
withAdministrator
IAM policy attached."arn:aws:iam::BBBBBBBB:role:role/Role_B"
withAdministrator
IAM policy attached and a trust relationship on actionsts:AssumeRole
with accountAAAAAAA
."arn:aws:iam::AAAAAAA:role/Role_A"
BBBBBBBB
, with backend S3 config also inBBBBBBBB
.aws
provider to assume_role"arn:aws:iam::BBBBBBBB:role:role/Role_B"
. Like in my example above.init
. Succeeds.plan
. AccessDenied errors.Important Factoids
TF_LOG=trace
, I am able to see that an initial call to STS is made onplan
and the role"arn:aws:iam::BBBBBBBB:role:role/Role_B"
is properly assumed using credentials from role"arn:aws:iam::AAAAAAA:role/Role_A"
. However, before the plan is finished, I see another STS call that fetches credentials from theEC2 MetaData
and re-assumes role"arn:aws:iam::AAAAAAA:role/Role_A"
, failing the rest of theplan
.aws
provider version3.x
as well since the authentication chain is modified from2.x
to 3.x`. Same errors occur.Terraform0.12.29
References
Could not find any other issues on these errors.
The text was updated successfully, but these errors were encountered: