@@ -310,6 +310,15 @@ func TestAccRegionInstanceGroupManager_distributionPolicy(t *testing.T) {
310
310
ImportStateVerify : true ,
311
311
ImportStateVerifyIgnore : []string {"status" },
312
312
},
313
+ {
314
+ Config : testAccRegionInstanceGroupManager_distributionPolicyUpdate (template , igm , zones ),
315
+ },
316
+ {
317
+ ResourceName : "google_compute_region_instance_group_manager.igm-basic" ,
318
+ ImportState : true ,
319
+ ImportStateVerify : true ,
320
+ ImportStateVerifyIgnore : []string {"status" },
321
+ },
313
322
},
314
323
})
315
324
}
@@ -1052,6 +1061,62 @@ resource "google_compute_region_instance_group_manager" "igm-basic" {
1052
1061
target_size = 2
1053
1062
distribution_policy_zones = ["%s"]
1054
1063
distribution_policy_target_shape = "ANY"
1064
+
1065
+ update_policy {
1066
+ instance_redistribution_type = "NONE"
1067
+ type = "OPPORTUNISTIC"
1068
+ minimal_action = "REPLACE"
1069
+ max_surge_fixed = 0
1070
+ max_unavailable_fixed = 6
1071
+ }
1072
+ }
1073
+ ` , template , igm , strings .Join (zones , "\" ,\" " ))
1074
+ }
1075
+
1076
+ func testAccRegionInstanceGroupManager_distributionPolicyUpdate (template , igm string , zones []string ) string {
1077
+ return fmt .Sprintf (`
1078
+ data "google_compute_image" "my_image" {
1079
+ family = "debian-11"
1080
+ project = "debian-cloud"
1081
+ }
1082
+
1083
+ resource "google_compute_instance_template" "igm-basic" {
1084
+ name = "%s"
1085
+ machine_type = "e2-medium"
1086
+ can_ip_forward = false
1087
+ tags = ["foo", "bar"]
1088
+ disk {
1089
+ source_image = data.google_compute_image.my_image.self_link
1090
+ auto_delete = true
1091
+ boot = true
1092
+ }
1093
+ network_interface {
1094
+ network = "default"
1095
+ }
1096
+ }
1097
+
1098
+ resource "google_compute_region_instance_group_manager" "igm-basic" {
1099
+ description = "Terraform test instance group manager"
1100
+ name = "%s"
1101
+
1102
+ version {
1103
+ instance_template = google_compute_instance_template.igm-basic.self_link
1104
+ name = "primary"
1105
+ }
1106
+
1107
+ base_instance_name = "tf-test-igm-basic"
1108
+ region = "us-central1"
1109
+ target_size = 2
1110
+ distribution_policy_zones = ["%s"]
1111
+ distribution_policy_target_shape = "BALANCED"
1112
+
1113
+ update_policy {
1114
+ instance_redistribution_type = "NONE"
1115
+ type = "OPPORTUNISTIC"
1116
+ minimal_action = "REPLACE"
1117
+ max_surge_fixed = 0
1118
+ max_unavailable_fixed = 6
1119
+ }
1055
1120
}
1056
1121
` , template , igm , strings .Join (zones , "\" ,\" " ))
1057
1122
}
0 commit comments