Skip to content

Commit 58d290c

Browse files
oceyralnat-henderson
authored andcommitted
Implement multiple versions for regional instance groups (hashicorp#1809)
1 parent 909cdb1 commit 58d290c

File tree

1 file changed

+70
-5
lines changed

1 file changed

+70
-5
lines changed

docs/r/compute_region_instance_group_manager.html.markdown

+70-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ and [API](https://cloud.google.com/compute/docs/reference/latest/regionInstanceG
1515

1616
~> **Note:** Use [google_compute_instance_group_manager](/docs/providers/google/r/compute_instance_group_manager.html) to create a single-zone instance group manager.
1717

18-
## Example Usage
18+
## Example Usage with top level instance template
1919

2020
```hcl
2121
resource "google_compute_health_check" "autohealing" {
@@ -55,6 +55,30 @@ resource "google_compute_region_instance_group_manager" "appserver" {
5555
5656
```
5757

58+
## Example Usage with multiple Versions
59+
```hcl
60+
resource "google_compute_region_instance_group_manager" "appserver" {
61+
name = "appserver-igm"
62+
63+
base_instance_name = "app"
64+
update_strategy = "NONE"
65+
region = "us-central1"
66+
67+
target_size = 5
68+
69+
version {
70+
instance_template = "${google_compute_instance_template.appserver.self_link}"
71+
}
72+
73+
version {
74+
instance_template = "${google_compute_instance_template.appserver-canary.self_link}"
75+
target_size {
76+
fixed = 1
77+
}
78+
}
79+
}
80+
```
81+
5882
## Argument Reference
5983

6084
The following arguments are supported:
@@ -66,8 +90,15 @@ The following arguments are supported:
6690
appending a hyphen and a random four-character string to the base instance
6791
name.
6892

69-
* `instance_template` - (Required) The full URL to an instance template from
70-
which all new instances will be created.
93+
* `instance_template` - (Optional) The full URL to an instance template from
94+
which all new instances will be created. Conflicts with `version` (see [documentation](https://cloud.google.com/compute/docs/instance-groups/updating-managed-instance-groups#relationship_between_instancetemplate_properties_for_a_managed_instance_group))
95+
96+
* `version` - (Optional) Application versions managed by this instance group. Each
97+
version deals with a specific instance template, allowing canary release scenarios.
98+
Conflicts with `instance_template`. Structure is documented below. Beware that
99+
exactly one version must not specify a target size. It means that versions with
100+
a target size will respect the setting, and the one without target size will
101+
be applied to all remaining Instances (top level target_size - each version target_size).
71102

72103
* `name` - (Required) The name of the instance group manager. Must be 1-63
73104
characters long and comply with
@@ -89,8 +120,8 @@ The following arguments are supported:
89120

90121
* `update_strategy` - (Optional, Default `"NONE"`) If the `instance_template`
91122
resource is modified, a value of `"NONE"` will prevent any of the managed
92-
instances from being restarted by Terraform. A value of `"ROLLING_UPDATE"`
93-
is supported as [Beta feature]. A value of `"ROLLING_UPDATE"` requires
123+
instances from being restarted by Terraform. A value of `"ROLLING_UPDATE"`
124+
is supported as [Beta feature]. A value of `"ROLLING_UPDATE"` requires
94125
`rolling_update_policy` block to be set
95126

96127
* `target_size` - (Optional) The target number of running instances for this managed
@@ -157,6 +188,40 @@ The **auto_healing_policies** block supports:
157188
* `initial_delay_sec` - (Required) The number of seconds that the managed instance group waits before
158189
it applies autohealing policies to new instances or recently recreated instances. Between 0 and 3600.
159190

191+
The **version** block supports:
192+
193+
```hcl
194+
version {
195+
name = "appserver-canary"
196+
instance_template = "${google_compute_instance_template.appserver-canary.self_link}"
197+
target_size {
198+
fixed = 1
199+
}
200+
}
201+
```
202+
203+
```hcl
204+
version {
205+
name = "appserver-canary"
206+
instance_template = "${google_compute_instance_template.appserver-canary.self_link}"
207+
target_size {
208+
percent = 20
209+
}
210+
}
211+
```
212+
213+
* `name` - (Required) - Version name.
214+
215+
* `instance_template` - (Required) - The full URL to an instance template from which all new instances of this version will be created.
216+
217+
* `target_size` - (Optional) - The number of instances calculated as a fixed number or a percentage depending on the settings. Structure is documented below.
218+
219+
The **target_size** block supports:
220+
221+
* `fixed` - (Optional), The number of instances which are managed for this version. Conflicts with `percent`.
222+
223+
* `percent` - (Optional), The number of instances (calculated as percentage) which are managed for this version. Conflicts with `fixed`.
224+
160225
## Attributes Reference
161226

162227
In addition to the arguments listed above, the following computed attributes are

0 commit comments

Comments
 (0)