Skip to content

Commit

Permalink
Remove force recreation of fields that can now be updated
Browse files Browse the repository at this point in the history
  • Loading branch information
wyardley committed Oct 19, 2024
1 parent 635fe1c commit 0b5b6a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ var (
"private_cluster_config.0.master_global_access_config",
}

forceNewClusterNodeConfigFields = []string{
"labels",
"workload_metadata_config",
"resource_manager_tags",
}

suppressDiffForAutopilot = schema.SchemaDiffSuppressFunc(func(k, oldValue, newValue string, d *schema.ResourceData) bool {
if v, _ := d.Get("enable_autopilot").(bool); v {
return true
Expand All @@ -126,19 +120,6 @@ var (
})
)

// This uses the node pool nodeConfig schema but sets
// node-pool-only updatable fields to ForceNew
func clusterSchemaNodeConfig() *schema.Schema {
nodeConfigSch := schemaNodeConfig()
schemaMap := nodeConfigSch.Elem.(*schema.Resource).Schema
for _, k := range forceNewClusterNodeConfigFields {
if sch, ok := schemaMap[k]; ok {
tpgresource.ChangeFieldSchemaToForceNew(sch)
}
}
return nodeConfigSch
}

// Defines default nodel pool settings for the entire cluster. These settings are
// overridden if specified on the specific NodePool object.
func clusterSchemaNodePoolDefaults() *schema.Schema {
Expand Down Expand Up @@ -1477,7 +1458,7 @@ func ResourceContainerCluster() *schema.Resource {
},
},

"node_config": clusterSchemaNodeConfig(),
"node_config": schemaNodeConfig(),

"node_pool": {
Type: schema.TypeList,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ func resourceContainerClusterResourceV1() *schema.Resource {
},
},

"node_config": clusterSchemaNodeConfig(),
"node_config": schemaNodeConfig(),

"node_pool": {
Type: schema.TypeList,
Expand Down

0 comments on commit 0b5b6a1

Please sign in to comment.