-
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
error configuring S3 Backend: no valid credential sources for S3 Backend found. #32448
Comments
I happen to solve the issue by downgrading aws cli to v2.4.11. When I did aws configure sso, it created the 9ceab8b92e009ecc15fdc2be3fe58963c97c5870.json json token for temporary access in the .aws/sso/cache folder. I have no idea why the name is different when using latest version of aws cli and thus it failing the terraform init because it is looking for that specific file name only. |
Thanks for this report! |
Thank you for submitting this, I'm experiencing the same problem. Downgrading from 2.9.15 -> 2.4.11 also resolved this issue for me. I didn't try other versions so I'm not sure if the problem started after 2.4.11. |
Also had this problem on aws-cli 2.9.14. I was able to resolve the issue with aws-cli 2.9.16. |
The latest aws cli version that worked for me was aws cli 2.7.32 - 2.8.x - breaks on
aws cli 2.9.0-2.9.20 -
2 notes:
|
I also got this when |
Any updates on this? Having the same issue with this. AWS: |
Hi for me the error message is slightly different.
But the problem seems to be the same, it occurs when I use aws sso, ex |
I'm experiencing the same issue.
|
I deleted all occurrences of the profile in ~/.aws/config I think it is the It's working now on those same versions. |
I was also seeing this issue,
I removed I'm running:
|
But how does that profile know which session to use or to use an sso session at all? |
Also running into the same issues:
Using brent's recommendation worked for now: |
I was experiencing the same issue and reverted to the cli v2.4.11 and it worked. |
Same issue here: MacOS 13.3.1 M1 ╷
│ Error: error configuring S3 Backend: no valid credential sources for S3 Backend found.
│
│ Please see https://www.terraform.io/docs/language/settings/backends/s3.html
│ for more information about providing credentials.
│
│ Error: SSOProviderInvalidToken: the SSO session has expired or is invalid
│ caused by: open /Users/username/.aws/sso/cache/7ad....0ebf54.json: no such file or directory |
I've got the same issue on Mac Book Pro System: Apple M1 Pro, macOS 13.3.1 (22E261)) My ~/.aws/config is:
For anyone experiencing this issue I have the following fix:
|
there are two types of aws config for SSO
You can refer to this AWS Doc |
It looks like this is down to the AWS SDK used by Terraform, and relates to aws/aws-sdk-go#4649. Thanks for your suggestion @0xF4D3C0D3, using the legacy config format works. |
I found the following to work ok
|
Unfortunately, this doesn't solve the essential problem that the AWS Go SDK, which Terraform relies on, supports only the legacy AWS config. What's the problem with the legacy config? It doesn't support automatic token refresh. So, we need to execute aws sso login every time the session expires. I do hope that the AWS Go SDK will support the new AWS config soon. |
my 5c to that problem. I was using cli commands but within editor ( IDEA IntelliJ 2023.1.2 ) and editor AWS plugin profile is not set by running command line profile change commands. I had manually to pick new profile, do the sso login and then all started to work for that particular profile. |
I have the same issue and the only thing that worked is copying an existing one to the one cp /Users/user/.aws/sso/cache/7505d64a*****.json /Users/user/.aws/sso/cache/395b71ba*****.json |
Another issue that happened: I had to modify my config file from [default]
sso_session = default
sso_account_id = [account-id]
sso_role_name = AdministratorAccess
region = us-east-1
output = json
sso_region = us-region-1
sso_start_url = https://[account-id-login].awsapps.com/start#/
sso_cache_duration = 0
[sso-session default]
sso_start_url = https://[account-id-login].awsapps.com/start#/
sso_registration_scopes = sso:account:access
sso_region = us-region-1 TO [default]
sso_start_url = https://[account-id-login].awsapps.com/start
sso_region = us-region-1
sso_account_id = [account-id]
sso_role_name = AdministratorAccess
region = us-region-1
output = json And I no longer getting
|
Thanks for the hint, I created a symlink on mine |
Looks like the upstream issue is on its way to being resolved with this PR. 🙏 |
The upstream fix is in: aws-sdk-go Release v1.44.298 (2023-07-07) |
Curious to know where this is on Hashicorp's priorities / when will this get fixed in TF? If you fresh install the latest awscli + terraform then try to authentication with an AWS SSO session (AWS preferred way of authenticating) terraform can't authenticate without manually editing AWS files which is not obvious. |
The linked issues have more details; additionally, over the next few releases, the AWS SDK dependency is being updated to version 2.x. |
This will be addressed in Terraform v1.6. If you still see this error when v1.6 is released (or you try any of the v1.6 beta releases), please open a new issue |
This will be addressed in Terraform v1.6. If you still see this error when v1.6 is released (or you try any of the v1.6 beta releases), please open a new issue |
We got the same issue with tf 1.5.7 and sam 2.13.26. Then our dev upgraded to 1.6+ it is resolved. We are still on our toes though. |
Thank you! |
For me the issue was latest version of terraform
|
For me, running awscli 2.14.2 and terraform cli 1.6.5 works off the bat. Both the latest versions as of writing, but using legacy sso config as referenced above
|
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
AWS CLI Version
Terraform Configuration Files
Debug Output
No relevant debug output except the few lines below (Actual Behaviour)
Expected Behavior
Should have applied initial config and download plugins
Actual Behavior
Error: error configuring S3 Backend: no valid credential sources for S3 Backend found.
│
│ Please see https://www.terraform.io/docs/language/settings/backends/s3.html
│ for more information about providing credentials.
│
│ Error: SSOProviderInvalidToken: the SSO session has expired or is invalid
│ caused by: open /Users/rsharma/.aws/sso/cache/9ceab8b92e009ecc15fdc2be3fe58963c97c5870.json: no such file or directory
│
Steps to Reproduce
Additional Context
I have set up and created aws sso profile. I can access aws s3 buckets using that profile
aws s3 ls --profile PROFILE_NAME
. I can also see json files in .aws/sso/cache and .aws/cli/cache. However, with terraform init, it couldn't file the the particular sessionReferences
No response
The text was updated successfully, but these errors were encountered: