Skip to content

Commit

Permalink
Rmeove use_legacy_workflow from S3 backend
Browse files Browse the repository at this point in the history
In Terraform 1.8 the use_legacy_workflow argument will be removed to encourage consistency with the AWS SDKs. The backend will now search for credentials in the same order as the default provider chain in the AWS SDKs and AWS CLI.
  • Loading branch information
jpogran committed Apr 1, 2024
1 parent 560df6b commit 9ea4b3c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions internal/schema/backends/backends.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ var (
v1_6_3 = version.Must(version.NewVersion("1.6.3"))
v1_6_4 = version.Must(version.NewVersion("1.6.4"))
v1_7_0 = version.Must(version.NewVersion("1.7.0"))
v1_8_0 = version.Must(version.NewVersion("1.8.0"))
)

func BackendTypesAsOneOfConstraint(tfVersion *version.Version) schema.OneOf {
Expand Down
18 changes: 12 additions & 6 deletions internal/schema/backends/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,6 @@ func s3Backend(v *version.Version) *schema.BodySchema {
},
},
}
bodySchema.Attributes["use_legacy_workflow"] = &schema.AttributeSchema{
Constraint: schema.LiteralType{Type: cty.Bool},
IsOptional: true,
Description: lang.Markdown("Use the legacy authentication workflow, preferring environment variables over backend configuration."),
}
bodySchema.Attributes["custom_ca_bundle"] = &schema.AttributeSchema{
Constraint: schema.LiteralType{Type: cty.String},
IsOptional: true,
Expand Down Expand Up @@ -541,7 +536,13 @@ func s3Backend(v *version.Version) *schema.BodySchema {
}
}

if v.GreaterThanOrEqual(v1_7_0) {
bodySchema.Attributes["use_legacy_workflow"] = &schema.AttributeSchema{
Constraint: schema.LiteralType{Type: cty.Bool},
IsOptional: true,
Description: lang.Markdown("Use the legacy authentication workflow, preferring environment variables over backend configuration."),
}

if v.GreaterThanOrEqual(v1_7_0) && v.LessThan(v1_8_0) {
bodySchema.Attributes["use_legacy_workflow"] = &schema.AttributeSchema{
Constraint: schema.LiteralType{Type: cty.Bool},
IsOptional: true,
Expand All @@ -550,5 +551,10 @@ func s3Backend(v *version.Version) *schema.BodySchema {
}
}

if v.GreaterThanOrEqual(v1_8_0) {
// In Terraform 1.8 the use_legacy_workflow argument is be removed to encourage consistency with the AWS SDKs
bodySchema.Attributes["use_legacy_workflow"] = nil
}

return bodySchema
}

0 comments on commit 9ea4b3c

Please sign in to comment.