hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io
Other
43.16k stars 9.58k forks source link

S3 Backend not use profile if you have AWS env variables set #32577

Closed clsonel-endava closed 1 year ago

clsonel-endava commented 1 year ago

Terraform Version

Terraform v1.3.7
on linux_amd64

Terraform Configuration Files

terraform {
  backend "s3" {
    encrypt = true
    profile = "my_profile"
    bucket  = "my_bucket"
    key     = "my_tfstate.tfstate"
    region  = "eu-west-1"
  }
  required_version = "1.3.7"
}

Debug Output

https://gist.github.com/clsonel-endava/7fbbc29296e0fe8ad2626cf9b02d0e08

Expected Behavior

Initializing the backend... 2023-01-25T17:01:42.671+0200 [INFO] Attempting to use session-derived credentials 2023-01-25T17:01:48.292+0200 [INFO] Successfully derived credentials from session 2023-01-25T17:01:48.292+0200 [INFO] AWS Auth provider used: "AssumeRoleProvider"

Actual Behavior

Initializing the backend... 2023-01-25T15:02:59.541Z [INFO] AWS Auth provider used: "EnvProvider"

Steps to Reproduce

terraform init

Additional Context

profile is simply ignored

References

No response

crw commented 1 year ago

Thanks for the report, I put it on the AWS Provider team's triage queue.

gdavison commented 1 year ago

This will be resolved when #30443 is complete. It is an active project this quarter.

gdavison commented 1 year ago

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

github-actions[bot] commented 12 months ago

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.