Skip to content

Latest commit

 

History

History
 
 

instance_template

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

instance_template

This submodule allows you to create a google_compute_instance_template resource, which is used as the basis for the other instance, managed, and unmanaged instance groups submodules.

Usage

See the simple for a usage example.

Inputs

Name Description Type Default Required
access_config Access configurations, i.e. IPs via which the VM instance can be accessed via the Internet.
list(object({
nat_ip = string
network_tier = string
}))
[] no
additional_disks List of maps of additional disks. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#disk_name
list(object({
disk_name = string
device_name = string
auto_delete = bool
boot = bool
disk_size_gb = number
disk_type = string
disk_labels = map(string)
}))
[] no
additional_networks Additional network interface details for GCE, if any.
list(object({
network = string
subnetwork = string
subnetwork_project = string
network_ip = string
access_config = list(object({
nat_ip = string
network_tier = string
}))
ipv6_access_config = list(object({
network_tier = string
}))
}))
[] no
alias_ip_range An array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks.
ip_cidr_range: The IP CIDR range represented by this alias IP range. This IP CIDR range must belong to the specified subnetwork and cannot contain IP addresses reserved by system or used by other network interfaces. At the time of writing only a netmask (e.g. /24) may be supplied, with a CIDR format resulting in an API error.
subnetwork_range_name: The subnetwork secondary range name specifying the secondary range from which to allocate the IP CIDR range for this alias IP range. If left unspecified, the primary range of the subnetwork will be used.
object({
ip_cidr_range = string
subnetwork_range_name = string
})
null no
auto_delete Whether or not the boot disk should be auto-deleted string "true" no
automatic_restart (Optional) Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user). bool true no
can_ip_forward Enable IP forwarding, for NAT instances for example string "false" no
disk_encryption_key The id of the encryption key that is stored in Google Cloud KMS to use to encrypt all the disks on this instance string null no
disk_labels Labels to be assigned to boot disk, provided as a map map(string) {} no
disk_size_gb Boot disk size in GB string "100" no
disk_type Boot disk type, can be either pd-ssd, local-ssd, or pd-standard string "pd-standard" no
enable_confidential_vm Whether to enable the Confidential VM configuration on the instance. Note that the instance image must support Confidential VMs. See https://cloud.google.com/compute/docs/images bool false no
enable_nested_virtualization Defines whether the instance should have nested virtualization enabled. bool false no
enable_shielded_vm Whether to enable the Shielded VM configuration on the instance. Note that the instance image must support Shielded VMs. See https://cloud.google.com/compute/docs/images bool false no
gpu GPU information. Type and count of GPU to attach to the instance template. See https://cloud.google.com/compute/docs/gpus more details
object({
type = string
count = number
})
null no
ipv6_access_config IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access.
list(object({
network_tier = string
}))
[] no
labels Labels, provided as a map map(string) {} no
machine_type Machine type to create, e.g. n1-standard-1 string "n1-standard-1" no
metadata Metadata, provided as a map map(string) {} no
min_cpu_platform Specifies a minimum CPU platform. Applicable values are the friendly names of CPU platforms, such as Intel Haswell or Intel Skylake. See the complete list: https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform string null no
name_prefix Name prefix for the instance template string "default-instance-template" no
network The name or self_link of the network to attach this interface to. Use network attribute for Legacy or Auto subnetted networks and subnetwork for custom subnetted networks. string "" no
network_ip Private IP address to assign to the instance if desired. string "" no
on_host_maintenance Instance availability Policy string "MIGRATE" no
preemptible Allow the instance to be preempted bool false no
project_id The GCP project ID string null no
region Region where the instance template should be created. string null no
service_account Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#service_account.
object({
email = string
scopes = set(string)
})
n/a yes
shielded_instance_config Not used unless enable_shielded_vm is true. Shielded VM configuration for the instance.
object({
enable_secure_boot = bool
enable_vtpm = bool
enable_integrity_monitoring = bool
})
{
"enable_integrity_monitoring": true,
"enable_secure_boot": true,
"enable_vtpm": true
}
no
source_image Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public CentOS image. string "" no
source_image_family Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public CentOS image. string "centos-7" no
source_image_project Project where the source image comes from. The default project contains CentOS images. string "centos-cloud" no
stack_type The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are IPV4_IPV6 or IPV4_ONLY. Default behavior is equivalent to IPV4_ONLY. string null no
startup_script User startup script to run when instances spin up string "" no
subnetwork The name of the subnetwork to attach this interface to. The subnetwork must exist in the same region this instance will be created in. Either network or subnetwork must be provided. string "" no
subnetwork_project The ID of the project in which the subnetwork belongs. If it is not provided, the provider project is used. string "" no
tags Network tags, provided as a list list(string) [] no
threads_per_core The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. number null no

Outputs

Name Description
name Name of instance template
self_link Self-link of instance template
tags Tags that will be associated with instance(s)