diff --git a/modules/instance_template/README.md b/modules/instance_template/README.md index ce489f5f..13647251 100644 --- a/modules/instance_template/README.md +++ b/modules/instance_template/README.md @@ -14,7 +14,7 @@ See the [simple](../../examples/instance_template/simple) for a usage example. | 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({| `[]` | no | -| additional\_disks | List of maps of additional disks. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#disk_name |
nat_ip = string
network_tier = string
}))
list(object({| `[]` | no | +| additional\_disks | List of maps of additional disks. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#disk_name |
disk_name = string
device_name = string
auto_delete = bool
boot = bool
disk_size_gb = number
disk_type = string
disk_labels = map(string)
}))
list(object({| `[]` | no | | additional\_networks | Additional network interface details for GCE, if any. |
disk_name = string
device_name = string
auto_delete = bool
boot = bool
disk_size_gb = number
disk_type = string
disk_labels = map(string)
source_snapshot = optional(string)
}))
list(object({| `[]` | 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.
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
}))
}))
object({| `null` | no | | auto\_delete | Whether or not the boot disk should be auto-deleted | `string` | `"true"` | no | diff --git a/modules/instance_template/main.tf b/modules/instance_template/main.tf index 22d8c11f..e05a8df6 100644 --- a/modules/instance_template/main.tf +++ b/modules/instance_template/main.tf @@ -76,18 +76,19 @@ resource "google_compute_instance_template" "tpl" { dynamic "disk" { for_each = local.all_disks content { - auto_delete = lookup(disk.value, "auto_delete", null) - boot = lookup(disk.value, "boot", null) - device_name = lookup(disk.value, "device_name", null) - disk_name = lookup(disk.value, "disk_name", null) - disk_size_gb = lookup(disk.value, "disk_size_gb", lookup(disk.value, "disk_type", null) == "local-ssd" ? "375" : null) - disk_type = lookup(disk.value, "disk_type", null) - interface = lookup(disk.value, "interface", lookup(disk.value, "disk_type", null) == "local-ssd" ? "NVME" : null) - mode = lookup(disk.value, "mode", null) - source = lookup(disk.value, "source", null) - source_image = lookup(disk.value, "source_image", null) - type = lookup(disk.value, "disk_type", null) == "local-ssd" ? "SCRATCH" : "PERSISTENT" - labels = lookup(disk.value, "disk_labels", null) + auto_delete = lookup(disk.value, "auto_delete", null) + boot = lookup(disk.value, "boot", null) + device_name = lookup(disk.value, "device_name", null) + disk_name = lookup(disk.value, "disk_name", null) + disk_size_gb = lookup(disk.value, "disk_size_gb", lookup(disk.value, "disk_type", null) == "local-ssd" ? "375" : null) + disk_type = lookup(disk.value, "disk_type", null) + interface = lookup(disk.value, "interface", lookup(disk.value, "disk_type", null) == "local-ssd" ? "NVME" : null) + mode = lookup(disk.value, "mode", null) + source = lookup(disk.value, "source", null) + source_image = lookup(disk.value, "source_image", null) + source_snapshot = lookup(disk.value, "source_snapshot", null) + type = lookup(disk.value, "disk_type", null) == "local-ssd" ? "SCRATCH" : "PERSISTENT" + labels = lookup(disk.value, "disk_labels", null) dynamic "disk_encryption_key" { for_each = compact([var.disk_encryption_key == null ? null : 1]) diff --git a/modules/instance_template/variables.tf b/modules/instance_template/variables.tf index 624b6431..a80ad371 100644 --- a/modules/instance_template/variables.tf +++ b/modules/instance_template/variables.tf @@ -163,13 +163,14 @@ variable "auto_delete" { variable "additional_disks" { description = "List of maps of additional disks. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#disk_name" type = list(object({ - disk_name = string - device_name = string - auto_delete = bool - boot = bool - disk_size_gb = number - disk_type = string - disk_labels = map(string) + disk_name = string + device_name = string + auto_delete = bool + boot = bool + disk_size_gb = number + disk_type = string + disk_labels = map(string) + source_snapshot = optional(string) })) default = [] }
ip_cidr_range = string
subnetwork_range_name = string
})