Skip to content
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

Terraform doesn't work with AWS CLI profiles that have quotes #35091

Open
evanstucker-hates-2fa opened this issue Apr 26, 2024 · 1 comment
Open
Labels
backend/s3 bug new new issue not yet triaged

Comments

@evanstucker-hates-2fa
Copy link

Terraform Version

Terraform v1.8.1
on linux_arm64
+ provider registry.terraform.io/cyrilgdn/postgresql v1.22.0
+ provider registry.terraform.io/hashicorp/aws v5.40.0
+ provider registry.terraform.io/hashicorp/random v3.6.0

Your version of Terraform is out of date! The latest version
is 1.8.2. You can update by downloading from https://www.terraform.io/downloads.html

Terraform Configuration Files

Not applicable

Debug Output

Not applicable

Expected Behavior

Workaround:
Remove quotes in AWS CLI profile names, and instead use \ to escape any spaces in profile names:

$ grep project-dev_Admin ~/.aws/config 
[profile project-dev_Admin] 
$ aws sts get-caller-identity 
{
    "UserId": "AROAREDACTEDREDACTED:evans@my.org",
    "Account": "99999999999",
    "Arn": "arn:aws:sts::99999999999:assumed-role/AWSReservedSSO_Admin_d33b4f06d3936657/evans@my.org"
}

$ terraform plan
Acquiring state lock. This may take a few moments...
...
Plan: 16 to add, 2 to change, 0 to destroy.
...

Actual Behavior

Problem:
Terraform doesn't work with AWS CLI profiles that have quotes:

$ grep project-dev_Admin ~/.aws/config 
[profile "project-dev_Admin"]
$ aws sts get-caller-identity 
{
    "UserId": "AROAREDACTEDREDACTED:evans@my.org",
    "Account": "99999999999",
    "Arn": "arn:aws:sts::99999999999:assumed-role/AWSReservedSSO_Admin_d33b4f06d3936657/evans@my.org"
}
$ terraform plan
╷
│ Error: failed to get shared config profile, project-dev_Admin

Steps to Reproduce

  1. Add quotes to one of the profile names in ${HOME}/.aws/config
  2. Run terraform plan - it doesn't work.

Additional Context

Desired Solution:
Update Terraform so that it can handle quoted AWS CLI profiles.

References

No response

@evanstucker-hates-2fa evanstucker-hates-2fa added bug new new issue not yet triaged labels Apr 26, 2024
@crw
Copy link
Collaborator

crw commented Apr 29, 2024

Thanks for filing this request! It has been brought to the attention of the AWS Provider maintainer team at HashiCorp, who also maintain the S3 Backend.

If you are viewing this issue and would like to indicate your interest, please use the 👍 reaction on the issue description to upvote this issue. We also welcome additional use case descriptions. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend/s3 bug new new issue not yet triaged
Projects
None yet
Development

No branches or pull requests

3 participants