Skip to content

Commit 442741f

Browse files
feat(compute): add terraform sample for min cpu platform and disks override functionality of instance flexibility policy on RMIG
1 parent 9171136 commit 442741f

File tree

1 file changed

+103
-0
lines changed
  • compute/rmig_instance_flexibility_policy/min_cpu_platform_and_disk_override

1 file changed

+103
-0
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/**
2+
* Copyright 2026 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
# [START compute_rmig_min_cpu_platform_and_disk_override_parent_tag]
18+
terraform {
19+
required_providers {
20+
google = {
21+
source = "hashicorp/google-beta"
22+
version = ">= 7.14.0"
23+
}
24+
}
25+
}
26+
27+
resource "google_compute_instance_template" "default" {
28+
name = "example-template"
29+
machine_type = "n2-standard-2"
30+
31+
disk {
32+
auto_delete = true
33+
device_name = "boot"
34+
boot = true
35+
source_image = "projects/debian-cloud/global/images/family/debian-12"
36+
disk_size_gb = 10
37+
disk_type = "pd-balanced"
38+
}
39+
40+
network_interface {
41+
network = "default"
42+
}
43+
}
44+
45+
# [START compute_rmig_min_cpu_platform_and_disk_override_tag]
46+
resource "google_compute_region_instance_group_manager" "default" {
47+
provider = google-beta
48+
name = "flex-igm"
49+
base_instance_name = "flex-igm-instance"
50+
region = "us-central1"
51+
52+
target_size = 2
53+
distribution_policy_target_shape = "ANY"
54+
55+
version {
56+
instance_template = google_compute_instance_template.default.id
57+
}
58+
59+
instance_flexibility_policy {
60+
instance_selections {
61+
name = "first-preference"
62+
rank = 1
63+
machine_types = ["n4-standard-4"]
64+
disks {
65+
auto_delete = true
66+
device_name = "boot"
67+
boot = true
68+
source_image = "projects/debian-cloud/global/images/family/debian-12"
69+
disk_size_gb = 10
70+
disk_type = "hyperdisk-balanced"
71+
}
72+
}
73+
74+
instance_selections {
75+
name = "second-preference"
76+
rank = 2
77+
machine_types = ["n2-standard-4"]
78+
min_cpu_platform = "Intel Ice Lake"
79+
disks {
80+
auto_delete = true
81+
device_name = "boot"
82+
boot = true
83+
source_image = "projects/debian-cloud/global/images/family/debian-12"
84+
disk_size_gb = 10
85+
disk_type = "pd-ssd"
86+
}
87+
}
88+
}
89+
90+
instance_lifecycle_policy {
91+
force_update_on_repair = "YES"
92+
}
93+
94+
update_policy {
95+
instance_redistribution_type = "NONE"
96+
type = "OPPORTUNISTIC"
97+
minimal_action = "REPLACE"
98+
max_surge_fixed = 0
99+
max_unavailable_fixed = 6
100+
}
101+
}
102+
# [END compute_rmig_min_cpu_platform_and_disk_override_tag]
103+
# [END compute_rmig_min_cpu_platform_and_disk_override_parent_tag]

0 commit comments

Comments
 (0)