-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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: Use new STS endpoint to validate creds #6536
aws: Use new STS endpoint to validate creds #6536
Conversation
I just received confirmation from AWS that |
Has this fix been verified? I just built TF from master and it still errors out: Get a token and then set env vars and call
Errors:
Here's my aws provider:
|
Ahh, looks like you have to pass the session token as |
LGTM! Thanks @radeksimko |
@radeksimko Thank you for this PR; it enables Okta credentials and remote state in S3. |
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. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
We were historically using
iam:GetUser
API for validating credentials, which however doesn't work on EC2 instances with IAM instance profiles (assumed roles) nor with other assumed roles for humans (via SAML/OpenID). In addition to that any credentials generated viasts:GetFederationToken
cannot call any STS or IAM endpoints.We originally avoided the mentioned limitations just by silently ignoring certain error codes coming from
iam:GetUser
. We don't have to do this anymore since the new STS endpoint was introduced (sts:GetCallerIdentity
).I was originally afraid that it will be yet another half-working method for validation with dozens of exceptions across different environments - e.g. STS can be disabled per regions. It however looks like the
sts:GetCallerIdentity
can be used even when explicitly denied via IAM policy (Deny
forsts:*
) and in region which has STS disabled. It can also be used (surprisingly) on EC2 instances. 🎉WIP: I approached AWS support as I want them to confirm that the inability to "disable" this API endpoint is intention and not a bug which would be fixed later on. I'm currently awaiting response from them.Fixes #6523