github.com/chalford/terraform@v0.3.7-0.20150113080010-a78c69a8c81f/website/source/docs/providers/google/r/compute_instance.html.markdown (about)

     1  ---
     2  layout: "google"
     3  page_title: "Google: google_compute_instance"
     4  sidebar_current: "docs-google-resource-instance"
     5  description: |-
     6    Manages a VM instance resource within GCE.
     7  ---
     8  
     9  # google\_compute\_instance
    10  
    11  Manages a VM instance resource within GCE.
    12  
    13  ## Example Usage
    14  
    15  ```
    16  resource "google_compute_instance" "default" {
    17  	name = "test"
    18  	machine_type = "n1-standard-1"
    19  	zone = "us-central1-a"
    20  	tags = ["foo", "bar"]
    21  
    22  	disk {
    23  		image = "debian-7-wheezy-v20140814"
    24  	}
    25  
    26  	network {
    27  		source = "default"
    28  	}
    29  
    30  	metadata {
    31  		foo = "bar"
    32  	}
    33  
    34  	service_account {
    35  		scopes = ["userinfo-email", "compute-ro", "storage-ro"]
    36  	}
    37  }
    38  ```
    39  
    40  ## Argument Reference
    41  
    42  The following arguments are supported:
    43  
    44  * `name` - (Required) A unique name for the resource, required by GCE.
    45      Changing this forces a new resource to be created.
    46  
    47  * `description` - (Optional) A brief description of this resource.
    48  
    49  * `machine_type` - (Required) The machine type to create.
    50  
    51  * `zone` - (Required) The zone that the machine should be created in.
    52  
    53  * `disk` - (Required) Disks to attach to the instance. This can be specified
    54      multiple times for multiple disks. Structure is documented below.
    55  
    56  * `can_ip_forward` - (Optional) Whether to allow sending and receiving of
    57      packets with non-matching source or destination IPs.
    58      This defaults to false.
    59  
    60  * `metadata` - (Optional) Metadata key/value pairs to make available from
    61      within the instance.
    62  
    63  * `network` - (Required) Networks to attach to the instance. This can be
    64      specified multiple times for multiple networks. Structure is documented
    65      below.
    66  
    67  * `service_account` - (Optional) Service account to attach to the instance.
    68  
    69  * `tags` - (Optional) Tags to attach to the instance.
    70  
    71  The `disk` block supports:
    72  
    73  * `disk` - (Required if image not set) The name of the disk (such as
    74       those managed by `google_compute_disk`) to attach.
    75  
    76  * `image` - (Required if disk not set) The name of the image to base
    77      this disk off of.
    78  
    79  * `auto_delete` - (Optional) Whether or not the disk should be auto-deleted.
    80      This defaults to true.
    81  
    82  * `type` - (Optional) The GCE disk type.
    83  
    84  The `network` block supports:
    85  
    86  * `source` - (Required) The name of the network to attach this interface to.
    87  
    88  * `address` - (Optional) The IP address of a reserved IP address to assign
    89       to this interface.
    90  
    91  The `service_account` block supports:
    92  
    93  * `scopes` - (Required) A list of service scopes. Both OAuth2 URLs and gcloud
    94      short names are supported.
    95  
    96  ## Attributes Reference
    97  
    98  The following attributes are exported:
    99  
   100  * `name` - The name of the resource.
   101  * `machine_type` - The type of machine.
   102  * `zone` - The zone the machine lives in.