Terraform: Document full AWS credential chain for S3 module sources#2322
Terraform: Document full AWS credential chain for S3 module sources#2322kevinburkesegment wants to merge 2 commits intohashicorp:mainfrom
Conversation
Vercel Previews Deployed
|
trujillo-adam
left a comment
There was a problem hiding this comment.
Thanks for making this update. I added a few suggestions for consistency with the style guide.
I only commented on the v1.1 version of the file until we've settled on the final text.
I already mentioned this on the v1.12 file, but this information is documented in the following section for v1.12 and newer:
https://developer.hashicorp.com/terraform/language/block/module#s3-bucket
You can leave it for the education team, but feel free to remove /terraform/language/modules/sources for newer versions. The site already redirects, so the should be no impact.
| Terraform uses the [default AWS credential provider chain](https://docs.aws.amazon.com/sdkref/latest/guide/standardized-credentials.html#credentialProviderChain) | ||
| from the AWS SDK to locate credentials. This includes, in order of precedence: | ||
| environment variables (`AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY`, or | ||
| `AWS_PROFILE` to select a named profile), the shared credentials file at | ||
| `~/.aws/credentials`, the shared config file at `~/.aws/config` (including SSO | ||
| and assume-role configuration), and container or EC2 instance profile | ||
| credentials (IMDS) when running on AWS compute. |
There was a problem hiding this comment.
| Terraform uses the [default AWS credential provider chain](https://docs.aws.amazon.com/sdkref/latest/guide/standardized-credentials.html#credentialProviderChain) | |
| from the AWS SDK to locate credentials. This includes, in order of precedence: | |
| environment variables (`AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY`, or | |
| `AWS_PROFILE` to select a named profile), the shared credentials file at | |
| `~/.aws/credentials`, the shared config file at `~/.aws/config` (including SSO | |
| and assume-role configuration), and container or EC2 instance profile | |
| credentials (IMDS) when running on AWS compute. | |
| Terraform uses the [default AWS credential provider chain](https://docs.aws.amazon.com/sdkref/latest/guide/standardized-credentials.html#credentialProviderChain) | |
| from the AWS SDK to locate credentials. In order of precedence, this includes: | |
| 1. Either `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`, or | |
| `AWS_PROFILE` environment variables. The `AWS_PROFILE` environment variable selects a named profile. | |
| 1. Shared credentials file at`~/.aws/credentials`. | |
| 1. Shared configuration file at `~/.aws/config`, including SSO and assume-role configuration. | |
| 1. Container or EC2 instance profile credentials (IMDS) when running on AWS compute. |
Numbered list is probably the best format.
| - `aws_profile` — use a named profile from the shared config, for example | ||
| `s3::https://bucket.s3.amazonaws.com/module.zip?aws_profile=dev`. | ||
| - `aws_access_key_id`, `aws_access_key_secret`, and `aws_access_token` — pass | ||
| static credentials inline. Avoid committing these to version control. |
There was a problem hiding this comment.
| - `aws_profile` — use a named profile from the shared config, for example | |
| `s3::https://bucket.s3.amazonaws.com/module.zip?aws_profile=dev`. | |
| - `aws_access_key_id`, `aws_access_key_secret`, and `aws_access_token` — pass | |
| static credentials inline. Avoid committing these to version control. | |
| - `aws_profile`: Specifies a named profile from the shared configuration, for example | |
| `s3::https://bucket.s3.amazonaws.com/module.zip?aws_profile=dev`. | |
| - `aws_access_key_id`, `aws_access_key_secret`, and `aws_access_token`: Pass | |
| static credentials inline. Do not commit these to version control. |
| - The default profile in the `.aws/credentials` file in your home directory. | ||
| - If running on an EC2 instance, temporary credentials associated with the | ||
| instance's IAM Instance Profile. | ||
| Terraform uses the [default AWS credential provider chain](https://docs.aws.amazon.com/sdkref/latest/guide/standardized-credentials.html#credentialProviderChain) |
There was a problem hiding this comment.
I thought we had removed this page, but since v1.12, this information has lived at https://developer.hashicorp.com/terraform/language/block/module#s3-bucket.
Can you copy the changes to the files for v1.12 and newer? The site should already redirect to the main instructions for using modules.
The module sources page listed only AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY, the default shared-credentials profile, and EC2 instance profiles. go-getter has used the AWS SDK default credential chain since v1.5.0 (2020), which Terraform has shipped since v1.0.0. That chain also honors AWS_PROFILE, shared config (SSO, assume-role, web-identity), and container credentials. Replace the list with a pointer to the AWS SDK default credential provider chain and document the aws_profile and static-credential URL query parameters supported by go-getter. Applied to every versioned copy (v1.1.x-v1.15.x rc). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Apply trujillo-adam's suggestions from PR hashicorp#2322: - Convert the credential chain paragraph into a numbered list. - Switch the URL query parameter bullets from em-dashes to colon-prefixed sentences. - Copy the updated content to content/terraform/v1.12.x+/docs/language/block/ module.mdx, where the S3 instructions live in newer versions. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
28ee35a to
35ee28b
Compare
The module sources page listed only AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY, the default shared-credentials profile, and EC2 instance profiles. go-getter has used the AWS SDK default credential chain since v1.5.0 (2020), which Terraform has shipped since v1.0.0. That chain also honors AWS_PROFILE, shared config (SSO, assume-role, web-identity), and container credentials.
Replace the list with a pointer to the AWS SDK default credential provider chain and document the aws_profile and static-credential URL query parameters supported by go-getter. Applied to every versioned copy (v1.1.x-v1.15.x rc).
Please go to the
Previewtab and select the appropriate template:Terraform