Skip to content

Commit e8ce0ed

Browse files
authored
Sync monorepo state at "[terraform provider] Make column type/is_array immutable" (#42)
Syncing from userclouds/userclouds@f22aeaa7b4dd1e3792e448899d59e79d7278c097
1 parent 5cc7692 commit e8ce0ed

File tree

19 files changed

+302
-35
lines changed

19 files changed

+302
-35
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ codegen: ## Generate provider code
1111
.PHONY: build
1212
build: codegen ## Build the provider binary
1313
go install .
14+
15+
.PHONY: test
16+
test: ## Run tests
17+
go test ./...

genprovider/config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"file": "userstore.yaml",
55
"generated_file_package": "userstore",
66
"schema_overrides": {
7+
"UserstoreColumn": {
8+
"immutable_properties": ["type", "is_array"]
9+
},
710
"IdpColumnRetentionDuration": {
811
"readonly_properties": ["default_duration", "purpose_name", "use_default"]
912
}

genprovider/internal/apitypes/array.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,17 @@ func (t *Array) JSONClientModelToTFFunc() string {
9191
return types.ListValueMust(childAttrType, out), nil
9292
}`
9393
}
94+
95+
// GetTFPlanModifierType returns the name of the
96+
// terraform-plugin-framework/resource/schema/planmodifier type for this API
97+
// type (e.g. String, Int64, etc.)
98+
func (t *Array) GetTFPlanModifierType() string {
99+
return "List"
100+
}
101+
102+
// GetTFPlanModifierPackageName returns the name of the package
103+
// (terraform-plugin-framework/resource/schema/RETURNVALUE) containing the plan
104+
// modifiers for this type
105+
func (t *Array) GetTFPlanModifierPackageName() string {
106+
return "listplanmodifier"
107+
}

genprovider/internal/apitypes/bool.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,17 @@ func (t *Bool) JSONClientModelToTFFunc() string {
5656
return types.BoolPointerValue(val), nil
5757
}`
5858
}
59+
60+
// GetTFPlanModifierType returns the name of the
61+
// terraform-plugin-framework/resource/schema/planmodifier type for this API
62+
// type (e.g. String, Int64, etc.)
63+
func (t *Bool) GetTFPlanModifierType() string {
64+
return "Bool"
65+
}
66+
67+
// GetTFPlanModifierPackageName returns the name of the package
68+
// (terraform-plugin-framework/resource/schema/RETURNVALUE) containing the plan
69+
// modifiers for this type
70+
func (t *Bool) GetTFPlanModifierPackageName() string {
71+
return "boolplanmodifier"
72+
}

genprovider/internal/apitypes/float.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,17 @@ func (t *Float) JSONClientModelToTFFunc() string {
5656
return types.Float64PointerValue(val), nil
5757
}`
5858
}
59+
60+
// GetTFPlanModifierType returns the name of the
61+
// terraform-plugin-framework/resource/schema/planmodifier type for this API
62+
// type (e.g. String, Int64, etc.)
63+
func (t *Float) GetTFPlanModifierType() string {
64+
return "Float64"
65+
}
66+
67+
// GetTFPlanModifierPackageName returns the name of the package
68+
// (terraform-plugin-framework/resource/schema/RETURNVALUE) containing the plan
69+
// modifiers for this type
70+
func (t *Float) GetTFPlanModifierPackageName() string {
71+
return "float64planmodifier"
72+
}

genprovider/internal/apitypes/int.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,17 @@ func (t *Int) JSONClientModelToTFFunc() string {
5656
return types.Int64PointerValue(val), nil
5757
}`
5858
}
59+
60+
// GetTFPlanModifierType returns the name of the
61+
// terraform-plugin-framework/resource/schema/planmodifier type for this API
62+
// type (e.g. String, Int64, etc.)
63+
func (t *Int) GetTFPlanModifierType() string {
64+
return "Int64"
65+
}
66+
67+
// GetTFPlanModifierPackageName returns the name of the package
68+
// (terraform-plugin-framework/resource/schema/RETURNVALUE) containing the plan
69+
// modifiers for this type
70+
func (t *Int) GetTFPlanModifierPackageName() string {
71+
return "int64planmodifier"
72+
}

genprovider/internal/apitypes/map.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,17 @@ func (t *Map) JSONClientModelToTFFunc() string {
9191
return types.MapValueMust(valueAttrType, out), nil
9292
}`
9393
}
94+
95+
// GetTFPlanModifierType returns the name of the
96+
// terraform-plugin-framework/resource/schema/planmodifier type for this API
97+
// type (e.g. String, Int64, etc.)
98+
func (t *Map) GetTFPlanModifierType() string {
99+
return "Map"
100+
}
101+
102+
// GetTFPlanModifierPackageName returns the name of the package
103+
// (terraform-plugin-framework/resource/schema/RETURNVALUE) containing the plan
104+
// modifiers for this type
105+
func (t *Map) GetTFPlanModifierPackageName() string {
106+
return "mapplanmodifier"
107+
}

genprovider/internal/apitypes/object.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,17 @@ func (t *Object) JSONClientModelToTFFunc() string {
102102
return objVal, nil
103103
}`
104104
}
105+
106+
// GetTFPlanModifierType returns the name of the
107+
// terraform-plugin-framework/resource/schema/planmodifier type for this API
108+
// type (e.g. String, Int64, etc.)
109+
func (t *Object) GetTFPlanModifierType() string {
110+
return "Object"
111+
}
112+
113+
// GetTFPlanModifierPackageName returns the name of the package
114+
// (terraform-plugin-framework/resource/schema/RETURNVALUE) containing the plan
115+
// modifiers for this type
116+
func (t *Object) GetTFPlanModifierPackageName() string {
117+
return "objectplanmodifier"
118+
}

genprovider/internal/apitypes/string.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,17 @@ func (t *String) JSONClientModelToTFFunc() string {
5656
return types.StringPointerValue(val), nil
5757
}`
5858
}
59+
60+
// GetTFPlanModifierType returns the name of the
61+
// terraform-plugin-framework/resource/schema/planmodifier type for this API
62+
// type (e.g. String, Int64, etc.)
63+
func (t *String) GetTFPlanModifierType() string {
64+
return "String"
65+
}
66+
67+
// GetTFPlanModifierPackageName returns the name of the package
68+
// (terraform-plugin-framework/resource/schema/RETURNVALUE) containing the plan
69+
// modifiers for this type
70+
func (t *String) GetTFPlanModifierPackageName() string {
71+
return "stringplanmodifier"
72+
}

genprovider/internal/apitypes/string_enum.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (t *StringEnum) description() string {
4141
desc += ", "
4242
}
4343
}
44-
if t.Schema.Description != nil && *t.Schema.Description != "" {
44+
if t.Schema != nil && t.Schema.Description != nil && *t.Schema.Description != "" {
4545
if !strings.HasSuffix(*t.Schema.Description, ".") {
4646
desc = ". " + desc
4747
}
@@ -90,3 +90,17 @@ func (t *StringEnum) JSONClientModelToTFFunc() string {
9090
return types.StringPointerValue(val), nil
9191
}`
9292
}
93+
94+
// GetTFPlanModifierType returns the name of the
95+
// terraform-plugin-framework/resource/schema/planmodifier type for this API
96+
// type (e.g. String, Int64, etc.)
97+
func (t *StringEnum) GetTFPlanModifierType() string {
98+
return "String"
99+
}
100+
101+
// GetTFPlanModifierPackageName returns the name of the package
102+
// (terraform-plugin-framework/resource/schema/RETURNVALUE) containing the plan
103+
// modifiers for this type
104+
func (t *StringEnum) GetTFPlanModifierPackageName() string {
105+
return "stringplanmodifier"
106+
}

0 commit comments

Comments
 (0)