Skip to content

Commit

Permalink
Merge pull request #34002 from knoppiks/no-sts-s3-backend
Browse files Browse the repository at this point in the history
Add skip_requesting_account_id Parameter to S3 Backend
  • Loading branch information
jar-b authored Oct 9, 2023
2 parents c820d44 + 09df221 commit 9d360ff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
28 changes: 17 additions & 11 deletions internal/backend/remote-state/s3/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ func (b *Backend) ConfigSchema() *configschema.Block {
Optional: true,
Description: "Skip the credentials validation via STS API.",
},
"skip_requesting_account_id": {
Type: cty.Bool,
Optional: true,
Description: "Skip the requesting account ID. Useful for AWS API implementations that do not have the IAM, STS API, or metadata API.",
},
"skip_metadata_api_check": {
Type: cty.Bool,
Optional: true,
Expand Down Expand Up @@ -956,17 +961,18 @@ func (b *Backend) Configure(obj cty.Value) tfdiags.Diagnostics {
ctx, baselog := baselogging.NewHcLogger(ctx, log)

cfg := &awsbase.Config{
AccessKey: stringAttr(obj, "access_key"),
APNInfo: stdUserAgentProducts(),
CallerDocumentationURL: "https://www.terraform.io/docs/language/settings/backends/s3.html",
CallerName: "S3 Backend",
Logger: baselog,
MaxRetries: intAttrDefault(obj, "max_retries", 5),
Profile: stringAttr(obj, "profile"),
Region: stringAttr(obj, "region"),
SecretKey: stringAttr(obj, "secret_key"),
SkipCredsValidation: boolAttr(obj, "skip_credentials_validation"),
Token: stringAttr(obj, "token"),
AccessKey: stringAttr(obj, "access_key"),
APNInfo: stdUserAgentProducts(),
CallerDocumentationURL: "https://www.terraform.io/docs/language/settings/backends/s3.html",
CallerName: "S3 Backend",
Logger: baselog,
MaxRetries: intAttrDefault(obj, "max_retries", 5),
Profile: stringAttr(obj, "profile"),
Region: stringAttr(obj, "region"),
SecretKey: stringAttr(obj, "secret_key"),
SkipCredsValidation: boolAttr(obj, "skip_credentials_validation"),
SkipRequestingAccountId: boolAttr(obj, "skip_requesting_account_id"),
Token: stringAttr(obj, "token"),
}

// The "legacy" authentication workflow used in aws-sdk-go-base V1 will be
Expand Down
1 change: 1 addition & 0 deletions website/docs/language/settings/backends/s3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ The following configuration is optional:
* `shared_credentials_files` - (Optional) List of paths to AWS shared credentials files. Defaults to `~/.aws/credentials`.
* `skip_credentials_validation` - (Optional) Skip credentials validation via the STS API.
* `skip_region_validation` - (Optional) Skip validation of provided region name.
* `skip_requesting_account_id` - (Optional) Whether to skip requesting the account ID. Useful for AWS API implementations that do not have the IAM, STS API, or metadata API.
* `skip_metadata_api_check` - (Optional) Skip usage of EC2 Metadata API.
* `sts_endpoint` - (Optional, **Deprecated**) Custom endpoint URL for the AWS Security Token Service (STS) API.
Use `endpoints.sts` instead.
Expand Down

0 comments on commit 9d360ff

Please sign in to comment.