Skip to content

Commit 652a98e

Browse files
Samir-Citg-awmalik
andauthored
feat: Add resource_manager_tags to module and use it on google_compute_instance_from_template. (#344)
Co-authored-by: Awais Malik <[email protected]>
1 parent fab60cd commit 652a98e

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

modules/compute_instance/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ See the [simple](https://github.com/terraform-google-modules/terraform-google-vm
2727
| network | Network to deploy to. Only one of network or subnetwork should be specified. | `string` | `""` | no |
2828
| num\_instances | Number of instances to create. This value is ignored if static\_ips is provided. | `number` | `"1"` | no |
2929
| region | Region where the instances should be created. | `string` | `null` | no |
30+
| resource\_manager\_tags | (Optional) A tag is a key-value pair that can be attached to a Google Cloud resource. You can use tags to conditionally allow or deny policies based on whether a resource has a specific tag. This value is not returned by the API. In Terraform, this value cannot be updated and changing it will recreate the resource. | `map(string)` | `null` | no |
3031
| resource\_policies | (Optional) A list of short names or self\_links of resource policies to attach to the instance. Modifying this list will cause the instance to recreate. Currently a max of 1 resource policy is supported. | `list(string)` | `[]` | no |
3132
| static\_ips | List of static IPs for VM instances | `list(string)` | `[]` | no |
3233
| subnetwork | Subnet to deploy to. Only one of network or subnetwork should be specified. | `string` | `""` | no |

modules/compute_instance/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ resource "google_compute_instance_from_template" "compute_instance" {
5252
resource_policies = var.resource_policies
5353
labels = var.labels
5454

55+
params {
56+
resource_manager_tags = var.resource_manager_tags
57+
}
58+
5559
dynamic "network_interface" {
5660
for_each = local.network_interface
5761

modules/compute_instance/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,9 @@ variable "labels" {
122122
description = "(Optional) Labels to override those from the template, provided as a map"
123123
default = null
124124
}
125+
126+
variable "resource_manager_tags" {
127+
description = "(Optional) A tag is a key-value pair that can be attached to a Google Cloud resource. You can use tags to conditionally allow or deny policies based on whether a resource has a specific tag. This value is not returned by the API. In Terraform, this value cannot be updated and changing it will recreate the resource."
128+
type = map(string)
129+
default = null
130+
}

0 commit comments

Comments
 (0)