Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove use_legacy_workflow from S3 backend #338

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
delete(bodySchema.Attributes, "use_legacy_workflow")
}

return bodySchema
}
Loading