terraform/provider: reject an explicitly empty compaction strategy

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 committed 2026-12-05 14:25:29 -08:00
1 parent e419cc2888
commit 751c0ce99c
2 files changed
+11

No files matched your search

@@ -377,6 +377,9 @@ func (r *s3TableMaintenanceResource) value(model s3TableMaintenanceResourceModel
return s3TableMaintenanceValue{}, fmt.Errorf("snapshot management settings cannot be used with %s", model.Type.ValueString())
}
strategy := model.Strategy.ValueString()
if !model.Strategy.IsNull() && !model.Strategy.IsUnknown() && strategy == "" {
return s3TableMaintenanceValue{}, fmt.Errorf("strategy must be auto, binpack, or sort; omit it to use the server default")
}
if strategy != "" && strategy != "auto" && strategy != "binpack" && strategy != "sort" {
return s3TableMaintenanceValue{}, fmt.Errorf("strategy must be auto, binpack, or sort")
}
@@ -153,6 +153,14 @@ func TestS3TableMaintenanceResourceValue(t *testing.T) {
if err == nil {
t.Fatal("expected unsupported compaction strategy to be rejected")
}
_, err = compaction.value(s3TableMaintenanceResourceModel{
Type: types.StringValue(s3TableMaintenanceCompaction),
Status: types.StringValue("enabled"),
Strategy: types.StringValue(""),
})
if err == nil {
t.Fatal("expected an explicitly empty compaction strategy to be rejected")
}
}
func TestParseTableMaintenanceImportID(t *testing.T) {