2015-02-16 16:07:26 +00:00
|
|
|
---
|
|
|
|
layout: "google"
|
2015-07-28 00:47:10 +00:00
|
|
|
page_title: "Google: google_compute_instance_group_manager"
|
2015-10-23 14:10:41 +00:00
|
|
|
sidebar_current: "docs-google-compute-instance-group-manager"
|
2015-02-16 16:07:26 +00:00
|
|
|
description: |-
|
2015-05-17 00:14:38 +00:00
|
|
|
Manages an Instance Group within GCE.
|
2015-02-16 16:07:26 +00:00
|
|
|
---
|
|
|
|
|
2015-07-28 00:47:10 +00:00
|
|
|
# google\_compute\_instance\_group\_manager
|
2015-05-17 00:14:38 +00:00
|
|
|
|
2015-02-16 16:07:26 +00:00
|
|
|
The Google Compute Engine Instance Group Manager API creates and manages pools
|
|
|
|
of homogeneous Compute Engine virtual machine instances from a common instance
|
2016-04-10 21:34:15 +00:00
|
|
|
template. For more information, see [the official documentation](https://cloud.google.com/compute/docs/instance-groups/manager)
|
2015-02-16 16:07:26 +00:00
|
|
|
and [API](https://cloud.google.com/compute/docs/instance-groups/manager/v1beta2/instanceGroupManagers)
|
|
|
|
|
|
|
|
## Example Usage
|
|
|
|
|
2017-04-17 10:17:54 +00:00
|
|
|
```hcl
|
2015-07-28 00:47:10 +00:00
|
|
|
resource "google_compute_instance_group_manager" "foobar" {
|
2016-04-10 21:34:15 +00:00
|
|
|
name = "terraform-test"
|
|
|
|
description = "Terraform test instance group manager"
|
|
|
|
|
|
|
|
base_instance_name = "foobar"
|
|
|
|
instance_template = "${google_compute_instance_template.foobar.self_link}"
|
|
|
|
update_strategy = "NONE"
|
|
|
|
zone = "us-central1-a"
|
2016-01-10 14:09:05 +00:00
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
target_pools = ["${google_compute_target_pool.foobar.self_link}"]
|
|
|
|
target_size = 2
|
|
|
|
|
|
|
|
named_port {
|
|
|
|
name = "customHTTP"
|
|
|
|
port = 8888
|
|
|
|
}
|
2015-02-16 16:07:26 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2015-09-11 18:56:20 +00:00
|
|
|
## Argument Reference
|
2015-02-16 16:07:26 +00:00
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
|
|
* `base_instance_name` - (Required) The base instance name to use for
|
2016-04-10 21:34:15 +00:00
|
|
|
instances in this group. The value must be a valid
|
|
|
|
[RFC1035](https://www.ietf.org/rfc/rfc1035.txt) name. Supported characters
|
|
|
|
are lowercase letters, numbers, and hyphens (-). Instances are named by
|
|
|
|
appending a hyphen and a random four-character string to the base instance
|
|
|
|
name.
|
|
|
|
|
|
|
|
* `instance_template` - (Required) The full URL to an instance template from
|
|
|
|
which all new instances will be created.
|
|
|
|
|
|
|
|
* `name` - (Required) The name of the instance group manager. Must be 1-63
|
|
|
|
characters long and comply with
|
|
|
|
[RFC1035](https://www.ietf.org/rfc/rfc1035.txt). Supported characters
|
|
|
|
include lowercase letters, numbers, and hyphens.
|
|
|
|
|
|
|
|
* `zone` - (Required) The zone that instances in this group should be created
|
|
|
|
in.
|
|
|
|
|
|
|
|
- - -
|
2015-02-16 16:07:26 +00:00
|
|
|
|
|
|
|
* `description` - (Optional) An optional textual description of the instance
|
2016-04-10 21:34:15 +00:00
|
|
|
group manager.
|
2015-02-16 16:07:26 +00:00
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
* `named_port` - (Optional) The named port configuration. See the section below
|
|
|
|
for details on configuration.
|
2015-11-12 20:44:31 +00:00
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
* `project` - (Optional) The project in which the resource belongs. If it
|
|
|
|
is not provided, the provider project is used.
|
2015-02-16 16:07:26 +00:00
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
* `update_strategy` - (Optional, Default `"RESTART"`) If the `instance_template`
|
|
|
|
resource is modified, a value of `"NONE"` will prevent any of the managed
|
|
|
|
instances from being restarted by Terraform. A value of `"RESTART"` will
|
|
|
|
restart all of the instances at once. In the future, as the GCE API matures
|
|
|
|
we will support `"ROLLING_UPDATE"` as well.
|
2015-02-16 16:07:26 +00:00
|
|
|
|
2017-06-16 22:39:44 +00:00
|
|
|
* `target_size` - (Optional) The target number of running instances for this managed
|
2017-06-13 19:43:18 +00:00
|
|
|
instance group. This value should always be explicitly set unless this resource is attached to
|
2017-06-16 22:39:44 +00:00
|
|
|
an autoscaler, in which case it should never be set. Defaults to `0`.
|
2015-02-16 16:07:26 +00:00
|
|
|
|
2015-07-30 14:46:16 +00:00
|
|
|
* `target_pools` - (Optional) The full URL of all target pools to which new
|
2016-04-10 21:34:15 +00:00
|
|
|
instances in the group are added. Updating the target pools attribute does
|
|
|
|
not affect existing instances.
|
2015-02-16 16:07:26 +00:00
|
|
|
|
2016-03-31 10:37:17 +00:00
|
|
|
The `named_port` block supports: (Include a `named_port` block for each named-port required).
|
2016-01-10 14:09:05 +00:00
|
|
|
|
|
|
|
* `name` - (Required) The name of the port.
|
|
|
|
|
|
|
|
* `port` - (Required) The port number.
|
|
|
|
|
2015-02-16 16:07:26 +00:00
|
|
|
## Attributes Reference
|
|
|
|
|
2016-04-10 21:34:15 +00:00
|
|
|
In addition to the arguments listed above, the following computed attributes are
|
|
|
|
exported:
|
|
|
|
|
|
|
|
* `fingerprint` - The fingerprint of the instance group manager.
|
2015-02-16 16:07:26 +00:00
|
|
|
|
2015-07-28 00:47:10 +00:00
|
|
|
* `instance_group` - The full URL of the instance group created by the manager.
|
2015-02-16 16:07:26 +00:00
|
|
|
|
|
|
|
* `self_link` - The URL of the created resource.
|