github.com/koding/terraform@v0.6.4-0.20170608090606-5d7e0339779d/website/source/docs/providers/google/r/compute_instance_group.html.markdown (about)

     1  ---
     2  layout: "google"
     3  page_title: "Google: google_compute_instance_group"
     4  sidebar_current: "docs-google-compute-instance-group"
     5  description: |-
     6    Manages an Instance Group within GCE.
     7  ---
     8  
     9  # google\_compute\_instance\_group
    10  
    11  The Google Compute Engine Instance Group API creates and manages pools
    12  of homogeneous Compute Engine virtual machine instances from a common instance
    13  template. For more information, see [the official documentation](https://cloud.google.com/compute/docs/instance-groups/#unmanaged_instance_groups)
    14  and [API](https://cloud.google.com/compute/docs/reference/latest/instanceGroups)
    15  
    16  ## Example Usage
    17  
    18  ### Empty instance group
    19  
    20  ```hcl
    21  resource "google_compute_instance_group" "test" {
    22    name        = "terraform-test"
    23    description = "Terraform test instance group"
    24    zone        = "us-central1-a"
    25    network     = "${google_compute_network.default.self_link}"
    26  }
    27  ```
    28  
    29  ### With instances and named ports
    30  
    31  ```hcl
    32  resource "google_compute_instance_group" "webservers" {
    33    name        = "terraform-webservers"
    34    description = "Terraform test instance group"
    35  
    36    instances = [
    37      "${google_compute_instance.test.self_link}",
    38      "${google_compute_instance.test2.self_link}",
    39    ]
    40  
    41    named_port {
    42      name = "http"
    43      port = "8080"
    44    }
    45  
    46    named_port {
    47      name = "https"
    48      port = "8443"
    49    }
    50  
    51    zone = "us-central1-a"
    52  }
    53  ```
    54  
    55  ## Argument Reference
    56  
    57  The following arguments are supported:
    58  
    59  * `name` - (Required) The name of the instance group. Must be 1-63
    60      characters long and comply with
    61      [RFC1035](https://www.ietf.org/rfc/rfc1035.txt). Supported characters
    62      include lowercase letters, numbers, and hyphens.
    63  
    64  * `zone` - (Required) The zone that this instance group should be created in.
    65  
    66  - - -
    67  
    68  * `description` - (Optional) An optional textual description of the instance
    69      group.
    70  
    71  * `instances` - (Optional) List of instances in the group. They should be given
    72      as self_link URLs. When adding instances they must all be in the same
    73      network and zone as the instance group.
    74  
    75  * `named_port` - (Optional) The named port configuration. See the section below
    76      for details on configuration.
    77  
    78  * `project` - (Optional) The project in which the resource belongs. If it
    79      is not provided, the provider project is used.
    80  
    81  * `network` - (Optional) The URL of the network the instance group is in. If
    82      this is different from the network where the instances are in, the creation
    83      fails. Defaults to the network where the instances are in (if neither
    84      `network` nor `instances` is specified, this field will be blank).
    85  
    86  The `named_port` block supports:
    87  
    88  * `name` - (Required) The name which the port will be mapped to.
    89  
    90  * `port` - (Required) The port number to map the name to.
    91  
    92  ## Attributes Reference
    93  
    94  In addition to the arguments listed above, the following computed attributes are
    95  exported:
    96  
    97  * `self_link` - The URI of the created resource.
    98  
    99  * `size` - The number of instances in the group.