-
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 S3 state backend fails with AWS SSO new profile format #32465
Comments
Thanks for the report, I'll notify the AWS provider team. |
Any updates on this? |
In the meantime, a workaround I found is to use the legacy non-refreshable configuration as per the AWS docs: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html#sso-configure-profile-legacy I created my profile manually according to the above docs, which now contains the Hopefully this gets fixed soon! |
An issue exists since early December: hashicorp/terraform-provider-aws#28263 |
The |
SSM PS doesn't support cross-account, so I have to deploy the resources across all 3 environments. Merge this after hashicorp/terraform#32465
I manually export and it works.. Though I need to do it every 8 hours ;) manually. |
hashicorp/terraform-provider-aws#28263 (comment) provides a workaround with S3 backend for now.. |
yea doesn't help when you use many aws accounts though or a different aws account for backend vs provider :(. you have to login to every account separately vs just one with session chaining. |
@crw this is not a problem on AWS provider, but on Terraform core, as it is from S3 remote state. The problem is located here: terraform/internal/backend/remote-state/s3/backend.go Lines 393 to 396 in 984d8c1
It is a function call to the code from aws-sdk-go-base HashiCorp module version v0.7.1 (see go.mod), which is a version released in 2021. Version 2.0.0 is in beta test, so it is not that easy to update the code as there is no stable release on this new version and it is not so simple to release a v0.7.2 just to fix this issue.
To fix this, it is needed to understand when is it going to have a stable release from version It is not necessary to update Terraform AWS SDK version to V2 itself, only updating to the newest version of the |
@lucasjrt The AWS Provider team supports the S3 Backend. See: https://github.com/hashicorp/terraform/blob/main/CODEOWNERS |
This fixed the issue for me. Setting manually the sso session on .aws/config and removing the sso_session block. |
thanks. it is the most important comment in this thread! |
I experience the same issue. I do not see a security flawed workaround as a long-term viable solution for production workloads. |
I tried #32465 (comment) to work around the issue. After doing that, I got this error:
The fix was to edit |
Any updates here? |
Getting this fixed will be very beneficial to the rest of the terraform community as it means we can standardize using the AWS SSO token provider configuration, instead of the legacy format. |
I found a temporary workaround. I went back and manually added the original
updated
|
I also had to remove |
It solved my problem - thanks! P.S. |
The workaround entirely removes usage of the This issue still is about adding support for the new format, which is still very much valid. |
Note that only the new SSO profile format supports automatic access key rotation, whilst the old one doesn't and always creates an access_token that expires after 8 hours. This is quite annoying and makes using the old format not an option for us https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-legacy.html |
Is this really still an issue? SSO is official way in AWS to use programmatic access to AWS, even terraform docs from AWS tutor redirected me to SSO steps when creating first user in IAC |
I had this issue just today, this with provider v4, I'll test with provider v5; or maybe it's not related to the provider? |
provider v4.54.0 and later should work. the issue is the s3 backend does not support session tokens. @hashicorp/terraform-aws is there a plan to fix this or is it on the road map? |
Yeah, I just checked latest TF and still happening, it doesn't even reach the stage for provider installation. |
Agree with @Carlos4ndresh - this has nothing to do with the provider if the provider isn't even grabbed by the point the error occurs. Doing a |
Confirmed this is still an issue on 1.5.2 - it is a problem with the S3 backend built in to the terraform process - not the AWS provider. |
Hi, I have opened a related issue here: #33431 |
Per hashicorp/terraform-provider-aws#28263 (comment)
so hopefully the new sdk can get merged into the next terraform release. |
@jbardin what is the ETA on Hashicorp pushing a new stable Terraform version out that uses the updated Go SDK? I don't even see mention to this in the 1.6 alpha releases. |
@et304383 See #33469 (comment), although this was posted in July there have been multiple S3 backend PRs merged since this comment, so I believe this work is underway. Per that comment, it will take a few releases to fully upgrade. Thanks! |
Hey Peeps, is there any official doc around this and/if we can expect this to be fixed? I now need to work with TF with a different AWS profile which makes it a bit awkward. |
The fix is in 1.6.0-beta1 |
Our workaround has been using aws-vault (v7+) and initiating with eg Native support would be nicer ofc... |
A previous comment stated that the fix is available in 1.6.0-beta1, which for me was not the case. For me, this has started working per 1.6.0-beta3, running on a Mac which I doubt matters. |
I can confirm everything works after upgrading to Terraform v1.6.0-rc1 |
I can confirm everything works fine on the released stable This issue can probably be closed now :) |
If you're still running into this as I was even after updating to 1.6+, check that your aws provider is greater than or equal to |
This helped me |
this saved my day 🙇
|
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. |
Terraform Version
Terraform Configuration Files
Debug Output
Expected Behavior
Terraform should work with the new AWS config format
Actual Behavior
Terraform throws error with the new AWS config format
Steps to Reproduce
AWS_PROFILE=xxx aws sso login
AWS_PROFILE=xxx AWS_REGION=yyy aws s3 ls <your-bucket-name>
)terraform init
, and receive the error message above.Additional Context
No response
References
No response
The text was updated successfully, but these errors were encountered: