Skip to content

Commit

Permalink
feat: support additional metadata for instances (#52)
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Zingel <[email protected]>
  • Loading branch information
flecno authored Oct 7, 2020
1 parent 1d98bc0 commit 46456a2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | `<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) | `<list>` | no |
| metadata | Key-value map of additional metadata to assign to the instances | map(string) | `<map>` | 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 |
Expand Down
9 changes: 6 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
}

0 comments on commit 46456a2

Please sign in to comment.