diff --git a/internal/resource/service_deployment_model.go b/internal/resource/service_deployment_model.go index 03c812a..91b30d4 100644 --- a/internal/resource/service_deployment_model.go +++ b/internal/resource/service_deployment_model.go @@ -238,7 +238,6 @@ type ServiceDeploymentPolicyBinding struct { } type ServiceDeploymentSyncConfig struct { - DiffNormalizer *ServiceDeploymentDiffNormalizer `tfsdk:"diff_normalizer"` NamespaceMetadata *ServiceDeploymentNamespaceMetadata `tfsdk:"namespace_metadata"` } @@ -248,38 +247,10 @@ func (this *ServiceDeploymentSyncConfig) Attributes() *gqlclient.SyncConfigAttri } return &gqlclient.SyncConfigAttributes{ - DiffNormalizer: this.DiffNormalizer.Attributes(), NamespaceMetadata: this.NamespaceMetadata.Attributes(), } } -type ServiceDeploymentDiffNormalizer struct { - Group types.String `tfsdk:"group"` - JsonPatches types.Set `tfsdk:"json_patches"` - Kind types.String `tfsdk:"kind"` - Name types.String `tfsdk:"name"` - Namespace types.String `tfsdk:"namespace"` -} - -func (this *ServiceDeploymentDiffNormalizer) Attributes() *gqlclient.DiffNormalizerAttributes { - if this == nil { - return nil - } - - jsonPatches := make([]types.String, len(this.JsonPatches.Elements())) - this.JsonPatches.ElementsAs(context.Background(), &jsonPatches, false) - - return &gqlclient.DiffNormalizerAttributes{ - Group: this.Group.ValueString(), - Kind: this.Kind.ValueString(), - Name: this.Name.ValueString(), - Namespace: this.Namespace.ValueString(), - JSONPatches: algorithms.Map(jsonPatches, func(v types.String) string { - return v.ValueString() - }), - } -} - type ServiceDeploymentNamespaceMetadata struct { Annotations types.Map `tfsdk:"annotations"` Labels types.Map `tfsdk:"labels"` diff --git a/internal/resource/service_deployment_schema.go b/internal/resource/service_deployment_schema.go index aaf912b..8dd8d2c 100644 --- a/internal/resource/service_deployment_schema.go +++ b/internal/resource/service_deployment_schema.go @@ -85,8 +85,8 @@ func (r *ServiceDeploymentResource) schemaKustomize() schema.SingleNestedAttribu } } -func (r *ServiceDeploymentResource) schemaConfiguration() schema.ListNestedAttribute { - return schema.ListNestedAttribute{ +func (r *ServiceDeploymentResource) schemaConfiguration() schema.SetNestedAttribute { + return schema.SetNestedAttribute{ Optional: true, Description: "List of [name, value] secrets used to alter this ServiceDeployment configuration.", MarkdownDescription: "List of [name, value] secrets used to alter this ServiceDeployment configuration.", @@ -165,7 +165,7 @@ func (r *ServiceDeploymentResource) schemaBindings() schema.SingleNestedAttribut Description: "Read and write policies of this ServiceDeployment.", MarkdownDescription: "Read and write policies of this ServiceDeployment.", Attributes: map[string]schema.Attribute{ - "read": schema.ListNestedAttribute{ + "read": schema.SetNestedAttribute{ Optional: true, Description: "Read policies of this ServiceDeployment.", MarkdownDescription: "Read policies of this ServiceDeployment.", @@ -183,7 +183,7 @@ func (r *ServiceDeploymentResource) schemaBindings() schema.SingleNestedAttribut }, }, }, - "write": schema.ListNestedAttribute{ + "write": schema.SetNestedAttribute{ Optional: true, Description: "Write policies of this ServiceDeployment.", MarkdownDescription: "Write policies of this ServiceDeployment.", @@ -214,27 +214,6 @@ func (r *ServiceDeploymentResource) schemaSyncConfig() schema.SingleNestedAttrib Description: "Settings for advanced tuning of the sync process.", MarkdownDescription: "Settings for advanced tuning of the sync process.", Attributes: map[string]schema.Attribute{ - "diff_normalizer": schema.SingleNestedAttribute{ - Optional: true, - Attributes: map[string]schema.Attribute{ - "group": schema.StringAttribute{ - Optional: true, - }, - "json_patches": schema.SetAttribute{ - ElementType: types.StringType, - Optional: true, - }, - "kind": schema.StringAttribute{ - Optional: true, - }, - "name": schema.StringAttribute{ - Optional: true, - }, - "namespace": schema.StringAttribute{ - Optional: true, - }, - }, - }, "namespace_metadata": schema.SingleNestedAttribute{ Optional: true, Attributes: map[string]schema.Attribute{