@@ -2,12 +2,12 @@ package index
22
33import (
44 "context"
5- "reflect"
65
76 "github.com/elastic/terraform-provider-elasticstack/internal/clients"
87 "github.com/elastic/terraform-provider-elasticstack/internal/clients/elasticsearch"
98 "github.com/elastic/terraform-provider-elasticstack/internal/diagutil"
109 "github.com/elastic/terraform-provider-elasticstack/internal/models"
10+ "github.com/elastic/terraform-provider-elasticstack/internal/utils"
1111 "github.com/hashicorp/terraform-plugin-framework-jsontypes/jsontypes"
1212 "github.com/hashicorp/terraform-plugin-framework/diag"
1313 "github.com/hashicorp/terraform-plugin-framework/resource"
@@ -115,7 +115,7 @@ func (r *Resource) updateSettings(ctx context.Context, client *clients.ApiClient
115115 }
116116 }
117117
118- if ! deepEqual (planDynamicSettings , stateDynamicSettings ) {
118+ if ! utils . MapsEqual (planDynamicSettings , stateDynamicSettings ) {
119119 // Settings which are being removed must be explicitly set to null in the new settings
120120 for setting := range stateDynamicSettings {
121121 if _ , ok := planDynamicSettings [setting ]; ! ok {
@@ -149,24 +149,3 @@ func (r *Resource) updateMappings(ctx context.Context, client *clients.ApiClient
149149
150150 return nil
151151}
152-
153- // deepEqual compares two maps for deep equality, handling slices and other types
154- // that are not comparable with maps.Equal
155- func deepEqual (a , b map [string ]interface {}) bool {
156- if len (a ) != len (b ) {
157- return false
158- }
159-
160- for key , valueA := range a {
161- valueB , exists := b [key ]
162- if ! exists {
163- return false
164- }
165-
166- if ! reflect .DeepEqual (valueA , valueB ) {
167- return false
168- }
169- }
170-
171- return true
172- }
0 commit comments