github.com/jmbataller/terraform@v0.6.8-0.20151125192640-b7a12e3a580c/website/source/docs/providers/google/r/compute_instance_template.html.markdown (about)

     1  ---
     2  layout: "google"
     3  page_title: "Google: google_compute_instance_template"
     4  sidebar_current: "docs-google-compute-instance-template"
     5  description: |-
     6    Manages a VM instance template resource within GCE.
     7  ---
     8  
     9  
    10  # google\_compute\_instance\_template
    11  
    12  Manages a VM instance template resource within GCE.  For more information see
    13  [the official documentation](https://cloud.google.com/compute/docs/instance-templates)
    14  and
    15  [API](https://cloud.google.com/compute/docs/reference/latest/instanceTemplates).
    16  
    17  
    18  ## Example Usage
    19  
    20  ```
    21  resource "google_compute_instance_template" "foobar" {
    22  	name = "terraform-test"
    23  	description = "template description"
    24  	instance_description = "description assigned to instances"
    25  	machine_type = "n1-standard-1"
    26  	can_ip_forward = false
    27  	automatic_restart = true
    28  	on_host_maintenance = "MIGRATE"
    29  	tags = ["foo", "bar"]
    30  
    31  	# Create a new boot disk from an image
    32  	disk {
    33  		source_image = "debian-7-wheezy-v20140814"
    34  		auto_delete = true
    35  		boot = true
    36  	}
    37  
    38  	# Use an existing disk resource
    39  	disk {
    40  		source = "foo_existing_disk"
    41  		auto_delete = false
    42  		boot = false
    43  	}
    44  
    45  	network_interface {
    46  		network = "default"
    47  	}
    48  
    49  	metadata {
    50  		foo = "bar"
    51  	}
    52  
    53  	service_account {
    54  		scopes = ["userinfo-email", "compute-ro", "storage-ro"]
    55  	}
    56  }
    57  ```
    58  
    59  ## Argument Reference
    60  
    61  Note that changing any field for this resource forces a new resource to be created.
    62  
    63  The following arguments are supported:
    64  
    65  * `name` - (Required) A unique name for the resource, required by GCE.
    66  
    67  * `description` - (Optional) A brief description of this resource.
    68  
    69  * `can_ip_forward` - (Optional) Whether to allow sending and receiving of
    70  	packets with non-matching source or destination IPs.
    71  	This defaults to false.
    72  
    73  * `instance_description` - (Optional) A brief description to use for instances
    74  	created from this template.
    75  
    76  * `machine_type` - (Required) The machine type to create.
    77  
    78  * `disk` - (Required) Disks to attach to instances created from this
    79  	template. This can be specified multiple times for multiple disks.
    80  	Structure is documented below.
    81  
    82  * `metadata` - (Optional) Metadata key/value pairs to make available from
    83  	within instances created from this template.
    84  
    85  * `network_interface` - (Required) Networks to attach to instances created from this template.
    86   	This can be specified multiple times for multiple networks. Structure is
    87  	documented below.
    88  
    89  * `automatic_restart` - (Optional, Deprecated - see `scheduling`) 
    90  	Specifies whether the instance should be
    91  	automatically restarted if it is terminated by Compute Engine (not
    92  	terminated by a user).
    93  	This defaults to true.
    94  
    95  * `on_host_maintenance` - (Optional, Deprecated - see `scheduling`) 
    96  	Defines the maintenance behavior for this instance.
    97  
    98  * `service_account` - (Optional) Service account to attach to the instance.
    99  
   100  * `tags` - (Optional) Tags to attach to the instance.
   101  
   102  
   103  
   104  The `disk` block supports:
   105  
   106  * `auto_delete` - (Optional) Whether or not the disk should be auto-deleted.
   107  	This defaults to true.
   108  
   109  * `boot` - (Optional) Indicates that this is a boot disk.
   110  
   111  * `device_name` - (Optional) A unique device name that is reflected into
   112  	the /dev/  tree of a Linux operating system running within the instance.
   113  	If not specified, the server chooses a default device name to apply to
   114  	this disk.
   115  
   116  * `disk_name` - (Optional) Name of the disk. When not provided, this defaults
   117  	to the name of the instance.
   118  
   119  * `source_image` - (Required if source not set) The name of the image to base
   120  	this disk off of.
   121  
   122  * `interface` - (Optional) Specifies the disk interface to use for attaching
   123  	this disk.
   124  
   125  * `mode` - (Optional) The mode in which to attach this disk, either READ_WRITE
   126  	or READ_ONLY. If you are attaching or creating a boot disk, this must
   127  	read-write mode.
   128  
   129  * `source` - (Required if source_image not set) The name of the disk (such as
   130  	those managed by `google_compute_disk`) to attach.
   131  
   132  * `type` - (Optional) The GCE disk type.
   133  
   134  The `network_interface` block supports:
   135  
   136  * `network` - (Required) The name of the network to attach this interface to.
   137  
   138  * `access_config` - (Optional) Access configurations, i.e. IPs via which this instance can be
   139    accessed via the Internet.  Omit to ensure that the instance is not accessible from the Internet
   140  (this means that ssh provisioners will not work unless you are running Terraform can send traffic to
   141  the instance's network (e.g. via tunnel or because it is running on another cloud instance on that
   142  network).  This block can be repeated multiple times.  Structure documented below.
   143  
   144  The `access_config` block supports:
   145  
   146  * `nat_ip` - (Optional) The IP address that will be 1:1 mapped to the instance's network ip.  If not
   147    given, one will be generated.
   148  
   149  The `service_account` block supports:
   150  
   151  * `scopes` - (Required) A list of service scopes. Both OAuth2 URLs and gcloud
   152  	short names are supported.
   153  
   154  The `scheduling` block supports:
   155  
   156  * `automatic_restart` - (Optional) Specifies whether the instance should be
   157  	automatically restarted if it is terminated by Compute Engine (not
   158  	terminated by a user).
   159  	This defaults to true.
   160  
   161  * `on_host_maintenance` - (Optional) Defines the maintenance behavior for this instance.
   162  
   163  * `preemptible` - (Optional) Allows instance to be preempted. Read 
   164  	more on this [here](https://cloud.google.com/compute/docs/instances/preemptible).
   165  
   166  ## Attributes Reference
   167  
   168  The following attributes are exported:
   169  
   170  * `self_link` - The URL of the created resource.