From 46456a29405f207b211481846d4d613f3e7430ac Mon Sep 17 00:00:00 2001 From: Ich Date: Wed, 7 Oct 2020 18:15:54 +0200 Subject: [PATCH] feat: support additional metadata for instances (#52) Signed-off-by: Timo Zingel --- README.md | 1 + main.tf | 9 ++++++--- variables.tf | 6 ++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fd276145..694ff7ae 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ provision a project with the necessary APIs enabled. | labels | Key-value map of labels to assign to the bastion host | map | `` | no | | machine\_type | Instance type for the Bastion host | string | `"n1-standard-1"` | no | | members | List of IAM resources to allow access to the bastion host | list(string) | `` | no | +| metadata | Key-value map of additional metadata to assign to the instances | map(string) | `` | no | | name | Name of the Bastion instance | string | `"bastion-vm"` | no | | name\_prefix | Name prefix for instance template | string | `"bastion-instance-template"` | no | | network | Self link for the network on which the Bastion should live | string | n/a | yes | diff --git a/main.tf b/main.tf index ab3feb64..a7eb8b76 100644 --- a/main.tf +++ b/main.tf @@ -64,9 +64,12 @@ module "instance_template" { tags = var.tags - metadata = { - enable-oslogin = "TRUE" - } + metadata = merge( + var.metadata, + { + enable-oslogin = "TRUE" + } + ) } resource "google_compute_instance_from_template" "bastion_vm" { diff --git a/variables.tf b/variables.tf index fd73478d..374739a4 100644 --- a/variables.tf +++ b/variables.tf @@ -197,3 +197,9 @@ variable "disk_type" { description = "Boot disk type, can be either pd-ssd, local-ssd, or pd-standard" default = "pd-standard" } + +variable "metadata" { + type = map(string) + description = "Key-value map of additional metadata to assign to the instances" + default = {} +}