From 73dc8459301886207e242fb755b7e31ba46c28e0 Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Fri, 19 Apr 2024 10:17:48 -0500 Subject: [PATCH] feat: Update instance template var.additional_disks to include all fields being passed to API (#399) --- modules/instance_template/README.md | 2 +- modules/instance_template/metadata.yaml | 20 ++++++++++++-------- modules/instance_template/variables.tf | 18 +++++++++++------- modules/instance_template/versions.tf | 2 +- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/modules/instance_template/README.md b/modules/instance_template/README.md index 2b39fee6..2cf3a49e 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({
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)
source_snapshot = optional(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 | diff --git a/modules/instance_template/metadata.yaml b/modules/instance_template/metadata.yaml index bedf26ee..1dc83206 100644 --- a/modules/instance_template/metadata.yaml +++ b/modules/instance_template/metadata.yaml @@ -28,7 +28,7 @@ spec: version: 11.1.0 actuationTool: flavor: Terraform - version: ">=0.13.0" + version: ">=1.3" description: {} content: examples: @@ -86,13 +86,17 @@ spec: description: List of maps of additional disks. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#disk_name varType: |- list(object({ - disk_name = string - device_name = string - auto_delete = bool - boot = bool - disk_size_gb = number - disk_type = string - disk_labels = map(string) + 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) })) defaultValue: [] diff --git a/modules/instance_template/variables.tf b/modules/instance_template/variables.tf index 2efa8608..2f92dc67 100644 --- a/modules/instance_template/variables.tf +++ b/modules/instance_template/variables.tf @@ -179,13 +179,17 @@ 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) + 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) })) default = [] diff --git a/modules/instance_template/versions.tf b/modules/instance_template/versions.tf index 916b6dbc..eac8c416 100644 --- a/modules/instance_template/versions.tf +++ b/modules/instance_template/versions.tf @@ -15,7 +15,7 @@ */ terraform { - required_version = ">=0.13.0" + required_version = ">=1.3" required_providers { google-beta = { source = "hashicorp/google-beta"