diff --git a/mmv1/third_party/terraform/resources/resource_container_cluster.go.erb b/mmv1/third_party/terraform/resources/resource_container_cluster.go.erb index d0f53829a594..d7e81f2c46f6 100644 --- a/mmv1/third_party/terraform/resources/resource_container_cluster.go.erb +++ b/mmv1/third_party/terraform/resources/resource_container_cluster.go.erb @@ -2928,6 +2928,9 @@ func expandMaintenancePolicy(d *schema.ResourceData, meta interface{}) *containe maintenancePolicy := l[0].(map[string]interface{}) if maintenanceExclusions, ok := maintenancePolicy["maintenance_exclusion"]; ok && len(maintenanceExclusions.(*schema.Set).List()) > 0 { + for k := range exclusions { + delete(exclusions, k) + } for _, me := range maintenanceExclusions.(*schema.Set).List() { exclusion := me.(map[string]interface{}) exclusions[exclusion["exclusion_name"].(string)] = containerBeta.TimeWindow{ diff --git a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb index 9084c3d91242..2df4a371eb8a 100644 --- a/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_container_cluster_test.go.erb @@ -1449,7 +1449,7 @@ func TestAccContainerCluster_withMaintenanceExclusionWindow(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccContainerCluster_withExclusion_DailyMaintenanceWindow(cluster, "2020-01-01T00:00:00Z", "2020-01-02T00:00:00Z", "2020-05-01T00:00:00Z", "2020-05-02T00:00:00Z"), + Config: testAccContainerCluster_withExclusion_DailyMaintenanceWindow(cluster, "2020-01-01T00:00:00Z", "2020-01-02T00:00:00Z"), }, { ResourceName: resourceName, @@ -3758,7 +3758,7 @@ resource "google_container_cluster" "with_maintenance_exclusion_window" { `, clusterName, w1startTime, w1endTime, w1startTime, w1endTime, w2startTime, w2endTime) } -func testAccContainerCluster_withExclusion_DailyMaintenanceWindow(clusterName string, w1startTime, w1endTime, w2startTime, w2endTime string) string { +func testAccContainerCluster_withExclusion_DailyMaintenanceWindow(clusterName string, w1startTime, w1endTime string) string { return fmt.Sprintf(` resource "google_container_cluster" "with_maintenance_exclusion_window" { @@ -3775,14 +3775,9 @@ resource "google_container_cluster" "with_maintenance_exclusion_window" { start_time = "%s" end_time = "%s" } - maintenance_exclusion { - exclusion_name = "holiday data load" - start_time = "%s" - end_time = "%s" - } } } -`, clusterName, w1startTime, w1endTime, w2startTime, w2endTime) +`, clusterName, w1startTime, w1endTime) } func testAccContainerCluster_withIPAllocationPolicy_existingSecondaryRanges(containerNetName string, clusterName string) string {