Skip to content

Terraform: Document full AWS credential chain for S3 module sources#2322

Open
kevinburkesegment wants to merge 2 commits intohashicorp:mainfrom
kevinburkesegment:update-s3-module-source-auth-docs
Open

Terraform: Document full AWS credential chain for S3 module sources#2322
kevinburkesegment wants to merge 2 commits intohashicorp:mainfrom
kevinburkesegment:update-s3-module-source-auth-docs

Conversation

@kevinburkesegment
Copy link
Copy Markdown

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 Preview tab and select the appropriate template:

Terraform

@kevinburkesegment kevinburkesegment requested review from a team as code owners April 27, 2026 22:12
@hashicorp-cla-app
Copy link
Copy Markdown

hashicorp-cla-app Bot commented Apr 27, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 27, 2026

Vercel Previews Deployed

Name Status Preview Updated (UTC)
Dev Portal ✅ Ready (Inspect) Visit Preview Tue May 5 01:16:07 UTC 2026
Unified Docs API ✅ Ready (Inspect) Visit Preview Tue May 5 01:11:45 UTC 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 27, 2026

Broken Link Checker

This PR contains broken links, but won't be blocked. Use this report to improve content quality:

Quick Actions

  • Internal links (HashiCorp sites): Please fix these - they impact user experience
  • External links: Consider if these are essential or can be updated/removed
  • Temporary issues: External sites may recover - check again before merging

Need Help?


Internal Links

Full Github Actions output

External Links

Summary

Status Count
🔍 Total 766
✅ Successful 228
⏳ Timeouts 0
🔀 Redirected 42
👻 Excluded 496
❓ Unknown 0
🚫 Errors 0
⛔ Unsupported 0

Redirects per input

Redirects in content/terraform/v1.1.x/docs/language/modules/sources.mdx

Redirects in content/terraform/v1.2.x/docs/language/modules/sources.mdx

Redirects in content/terraform/v1.3.x/docs/language/modules/sources.mdx

Redirects in content/terraform/v1.4.x/docs/language/modules/sources.mdx

Redirects in content/terraform/v1.5.x/docs/language/modules/sources.mdx

Redirects in content/terraform/v1.6.x/docs/language/modules/sources.mdx

Redirects in content/terraform/v1.7.x/docs/language/modules/sources.mdx

Redirects in content/terraform/v1.8.x/docs/language/modules/sources.mdx

Redirects in content/terraform/v1.9.x/docs/language/modules/sources.mdx

Redirects in content/terraform/v1.10.x/docs/language/modules/sources.mdx

Redirects in content/terraform/v1.11.x/docs/language/modules/sources.mdx

Redirects in content/terraform/v1.12.x/docs/language/block/module.mdx

Redirects in content/terraform/v1.12.x/docs/language/modules/sources.mdx

Redirects in content/terraform/v1.13.x/docs/language/block/module.mdx

Redirects in content/terraform/v1.13.x/docs/language/modules/sources.mdx

Redirects in content/terraform/v1.14.x/docs/language/block/module.mdx

Redirects in content/terraform/v1.14.x/docs/language/modules/sources.mdx

Redirects in content/terraform/v1.15.x/docs/language/block/module.mdx

Redirects in content/terraform/v1.15.x/docs/language/modules/sources.mdx

Full Github Actions output

Copy link
Copy Markdown
Contributor

@trujillo-adam trujillo-adam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +402 to +408
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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines +413 to +416
- `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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

- 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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

kevinburkesegment and others added 2 commits May 4, 2026 17:46
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>
@kevinburkesegment kevinburkesegment force-pushed the update-s3-module-source-auth-docs branch from 28ee35a to 35ee28b Compare May 5, 2026 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants