diff --git a/tools/codegen/schema/schema_attribute_timeout.go b/tools/codegen/schema/schema_attribute_timeout.go index 1cd92e0cab..4dc1928870 100644 --- a/tools/codegen/schema/schema_attribute_timeout.go +++ b/tools/codegen/schema/schema_attribute_timeout.go @@ -12,15 +12,15 @@ type timeoutAttributeGenerator struct { func (s *timeoutAttributeGenerator) AttributeCode() CodeStatement { var optionProperties string - for op := range s.timeouts.ConfigurableTimeouts { + for _, op := range s.timeouts.ConfigurableTimeouts { switch op { - case int(codespec.Create): + case codespec.Create: optionProperties += "Create: true,\n" - case int(codespec.Update): + case codespec.Update: optionProperties += "Update: true,\n" - case int(codespec.Delete): + case codespec.Delete: optionProperties += "Delete: true,\n" - case int(codespec.Read): + case codespec.Read: optionProperties += "Read: true,\n" } } diff --git a/tools/codegen/schema/schema_file_test.go b/tools/codegen/schema/schema_file_test.go index f8f6b82cad..1004fa8f22 100644 --- a/tools/codegen/schema/schema_file_test.go +++ b/tools/codegen/schema/schema_file_test.go @@ -152,7 +152,7 @@ func TestSchemaGenerationFromCodeSpec(t *testing.T) { { Name: "timeouts", Timeouts: &codespec.TimeoutsAttribute{ - ConfigurableTimeouts: []codespec.Operation{codespec.Create, codespec.Read, codespec.Delete}, + ConfigurableTimeouts: []codespec.Operation{codespec.Create, codespec.Update, codespec.Delete}, }, }, }, diff --git a/tools/codegen/schema/testdata/timeouts.golden.go b/tools/codegen/schema/testdata/timeouts.golden.go index 5efeab73a8..b87719bd8b 100644 --- a/tools/codegen/schema/testdata/timeouts.golden.go +++ b/tools/codegen/schema/testdata/timeouts.golden.go @@ -13,7 +13,7 @@ func ResourceSchema(ctx context.Context) schema.Schema { "timeouts": timeouts.Attributes(ctx, timeouts.Opts{ Create: true, Update: true, - Read: true, + Delete: true, }), }, }