Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(instance_template): supporting template and generated instance description #388

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/instance_template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ See the [simple](../../examples/instance_template/simple) for a usage example.
| 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 |
| description | The template's description | `string` | `""` | 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\_resource\_policies | A list (short name or id) of resource policies to attach to this disk for automatic snapshot creations | `list(string)` | `[]` | no |
Expand All @@ -29,6 +30,7 @@ See the [simple](../../examples/instance_template/simple) for a usage example.
| 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 | <pre>object({<br> type = string<br> count = number<br> })</pre> | `null` | no |
| instance\_description | Description of the generated instances | `string` | `""` | 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. | <pre>list(object({<br> network_tier = string<br> }))</pre> | `[]` | 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 |
Expand Down
2 changes: 2 additions & 0 deletions modules/instance_template/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ locals {
resource "google_compute_instance_template" "tpl" {
provider = google-beta
name_prefix = "${var.name_prefix}-"
description = var.description
instance_description = var.instance_description
project = var.project_id
machine_type = var.machine_type
labels = var.labels
Expand Down
8 changes: 8 additions & 0 deletions modules/instance_template/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ spec:
description: Enable IP forwarding, for NAT instances for example
varType: string
defaultValue: "false"
- name: description
description: The template's description
varType: string
defaultValue: ""
- name: disk_encryption_key
description: The id of the encryption key that is stored in Google Cloud KMS to use to encrypt all the disks on this instance
varType: string
Expand Down Expand Up @@ -184,6 +188,10 @@ spec:
type = string
count = number
})
- name: instance_description
description: Description of the generated instances
varType: string
defaultValue: ""
- name: ipv6_access_config
description: 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.
varType: |-
Expand Down
12 changes: 12 additions & 0 deletions modules/instance_template/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ variable "name_prefix" {
default = "default-instance-template"
}

variable "description" {
description = "The template's description"
type = string
default = ""
}

variable "instance_description" {
description = "Description of the generated instances"
type = string
default = ""
}

variable "machine_type" {
description = "Machine type to create, e.g. n1-standard-1"
type = string
Expand Down