diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster_internal_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_cluster_internal_test.go.tmpl index fd84d987f04c..e48e516d2545 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster_internal_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster_internal_test.go.tmpl @@ -664,6 +664,10 @@ func TestUnitFlattenClusterNodePools(t *testing.T) { Optional: true, Elem: &schema.Resource{Schema: map[string]*schema.Schema{"create_pod_range": {Type: schema.TypeBool}}}, }, + "ignore_node_count_changes": { + Type: schema.TypeBool, + Optional: true, + }, }, }, Optional: true, @@ -701,6 +705,7 @@ func TestUnitFlattenClusterNodePools(t *testing.T) { "managed_instance_group_urls": []string{}, "version": "", "network_config": []map[string]interface{}{}, + "ignore_node_count_changes": false, }, { "name": "pool-2", @@ -713,6 +718,7 @@ func TestUnitFlattenClusterNodePools(t *testing.T) { "managed_instance_group_urls": []string{}, "version": "", "network_config": []map[string]interface{}{}, + "ignore_node_count_changes": false, }, }, expectError: false, diff --git a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl index da21832b9613..dbb85f65208b 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_cluster_test.go.tmpl @@ -1992,7 +1992,9 @@ func TestAccContainerCluster_regionalWithNodePool(t *testing.T) { ResourceName: "google_container_cluster.regional", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"deletion_protection", "ignore_node_count_changes", "node_pool.0.ignore_node_count_changes"}, + // Virtual fields like ignore_node_count_changes are not loaded on import. When import runs with default + // false for ignore_node_count_changes, managed_instance_group_urls is populated from the API, causing an import diff. + ImportStateVerifyIgnore: []string{"deletion_protection", "ignore_node_count_changes", "node_pool.0.ignore_node_count_changes", "node_pool.0.managed_instance_group_urls"}, }, }, }) diff --git a/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.tmpl b/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.tmpl index e808ce486cb7..4e7b40d61257 100644 --- a/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.tmpl +++ b/mmv1/third_party/terraform/services/container/resource_container_node_pool.go.tmpl @@ -1562,7 +1562,8 @@ func flattenNodePool(d *schema.ResourceData, config *transport_tpg.Config, np *c "instance_group_urls": igmUrls, "managed_instance_group_urls": managedIgmUrls, "version": np.Version, - "network_config": flattenNodeNetworkConfig(np.NetworkConfig, d, prefix), + "network_config": flattenNodeNetworkConfig(np.NetworkConfig, d, prefix), + "ignore_node_count_changes": d.Get(prefix + "ignore_node_count_changes"), } if np.Autoscaling != nil {