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({
auto_delete = optional(bool, true)
boot = optional(bool, false)
device_name = optional(string)
disk_name = optional(string)
disk_size_gb = optional(number)
disk_type = optional(string)
disk_labels = optional(map(string), {})
interface = optional(string)
mode = optional(string)
source = optional(string)
source_image = optional(string)
source_snapshot = optional(string)
}))
[] no
additional_networks Additional network interface details for GCE, if any.
list(object({
network = string
subnetwork = string
subnetwork_project = string
network_ip = string
nic_type = string
stack_type = string
queue_count = number
access_config = list(object({
nat_ip = string
network_tier = string
}))
ipv6_access_config = list(object({
network_tier = string
}))
alias_ip_range = list(object({
ip_cidr_range = string
subnetwork_range_name = 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
maintenance_interval Specifies the frequency of planned maintenance events string null 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
nic_type Valid values are "VIRTIO_NET", "GVNIC" or set to null to accept API default behavior. string null 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
resource_policies A list of self_links of resource policies to attach to the instance. Modifying this list will cause the instance to recreate. Currently a max of 1 resource policy is supported. list(string) [] 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 Rocky Linux 9 optimized for GCP image. string "" no
source_image_family Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image. string "rocky-linux-9-optimized-gcp" no
source_image_project Project where the source image comes from. The default project contains Rocky Linux images. string "rocky-linux-cloud" no
spot Provision a SPOT instance bool false no
spot_instance_termination_action Action to take when Compute Engine preempts a Spot VM. string "STOP" 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
total_egress_bandwidth_tier Egress bandwidth tier setting for supported VM families string "DEFAULT" no

Outputs

Name Description
name Name of instance template
self_link Self-link of instance template
self_link_unique Unique self-link of instance template (recommended output to use instead of self_link)
tags Tags that will be associated with instance(s)