Skip to content

Commit 69ad6b3

Browse files
committed
feat: default quota definitions to empty
1 parent 4fa8d52 commit 69ad6b3

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

internal/provider/platform_resource.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ func (r *platformResource) Schema(_ context.Context, _ resource.SchemaRequest, r
7070
"* Deleting and re-creating a platform with the same identifier is not possible. Once you have used a platform identifier, you cannot use it again, even if the platform has been deleted. You may run into this issue when you attempt to modify an immutable attribute and terraform therefore attempts to replace (i.e., delete and recreate) the entire platform, which will result in an error with a status code of `409` due to the identifier already being used by a deleted platform.\n" +
7171
"* Changing the owning workspace of a platform (`metadata.owned_by_workspace`) is not possible. To transfer the ownership of a platform, you must use meshPanel."
7272

73+
quotaDefinitionAttrTypes := map[string]attr.Type{
74+
"quota_key": types.StringType,
75+
"label": types.StringType,
76+
"description": types.StringType,
77+
"unit": types.StringType,
78+
"min_value": types.Int64Type,
79+
"max_value": types.Int64Type,
80+
"auto_approval_threshold": types.Int64Type,
81+
}
82+
7383
resp.Schema = schema.Schema{
7484
MarkdownDescription: markdownDescription,
7585
Attributes: map[string]schema.Attribute{
@@ -214,19 +224,15 @@ func (r *platformResource) Schema(_ context.Context, _ resource.SchemaRequest, r
214224
},
215225
"quota_definitions": schema.ListAttribute{
216226
MarkdownDescription: "List of quota definitions for the platform.",
217-
Required: true,
227+
Optional: true,
228+
Computed: true,
218229
Sensitive: false,
219230
ElementType: types.ObjectType{
220-
AttrTypes: map[string]attr.Type{
221-
"quota_key": types.StringType,
222-
"label": types.StringType,
223-
"description": types.StringType,
224-
"unit": types.StringType,
225-
"min_value": types.Int64Type,
226-
"max_value": types.Int64Type,
227-
"auto_approval_threshold": types.Int64Type,
228-
},
231+
AttrTypes: quotaDefinitionAttrTypes,
229232
},
233+
Default: listdefault.StaticValue(types.ListValueMust(types.ObjectType{
234+
AttrTypes: quotaDefinitionAttrTypes,
235+
}, []attr.Value{})),
230236
},
231237
"config": schema.SingleNestedAttribute{
232238
MarkdownDescription: "Platform-specific configuration settings.",

0 commit comments

Comments
 (0)