Skip to content

Commit

Permalink
Supporting template and generated instance description
Browse files Browse the repository at this point in the history
  • Loading branch information
YpNo committed Mar 19, 2024
1 parent 0cf3225 commit 836ef79
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
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\_size\_gb | Boot disk size in GB | `string` | `"100"` | no |
Expand All @@ -28,6 +29,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 @@ -65,6 +65,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
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

0 comments on commit 836ef79

Please sign in to comment.