Enable repd tag bindings in compute-vm module (#3063)
* enable repd tag bindings in compute-vm module * tfdoc
This commit is contained in:
committed by
GitHub
parent
e547d4d29c
commit
623f2b0113
@@ -828,8 +828,8 @@ module "instance" {
|
||||
Resource manager tags bindings for use in IAM or org policy conditions are supported via three different variables:
|
||||
|
||||
- `network_tag_bindings` associates tags to instances after creation, and is meant for use with network firewall policies
|
||||
- `tag_bindings` associates tags to instances and zonal disks after creation, and is meant for use with IAM or organization policy conditions
|
||||
- `tag_bindings_immutable` associates tags to instances and disks created as part of the instance, or instance templates; the binding is applied at creation time and triggers resource recreation on change
|
||||
- `tag_bindings` associates tags to instances and disks after creation, and is meant for use with IAM or organization policy conditions
|
||||
- `tag_bindings_immutable` associates tags to instances and disks during the instance or template creation flow; these bindings are immutable and changes trigger resource recreation
|
||||
|
||||
The non-immutable variables follow our usual interface for tag bindings, and support specifying a map with arbitrary keys mapping to tag key or value ids. To prevent a provider permadiff also pass in the project number in the `project_number` variable.
|
||||
|
||||
|
||||
@@ -35,15 +35,15 @@ locals {
|
||||
}
|
||||
]
|
||||
])
|
||||
# region_disk_tags = flatten([
|
||||
# for k, v in var.tag_bindings : [
|
||||
# for dk, dv in google_compute_region_disk.disks : {
|
||||
# disk_id = dv.disk_id
|
||||
# key = "${dk}/${k}"
|
||||
# tag_value = v
|
||||
# }
|
||||
# ]
|
||||
# ])
|
||||
region_disk_tags = flatten([
|
||||
for k, v in var.tag_bindings : [
|
||||
for dk, dv in google_compute_region_disk.disks : {
|
||||
disk_id = dv.disk_id
|
||||
key = "${dk}/${k}"
|
||||
tag_value = v
|
||||
}
|
||||
]
|
||||
])
|
||||
tag_parent_base = format(
|
||||
"//compute.googleapis.com/projects/%s",
|
||||
coalesce(var.project_number, var.project_id)
|
||||
@@ -92,18 +92,16 @@ resource "google_tags_location_tag_binding" "disks" {
|
||||
location = var.zone
|
||||
}
|
||||
|
||||
# TODO: enable once regional disks support disk_id
|
||||
|
||||
# resource "google_tags_location_tag_binding" "disks_regional" {
|
||||
# for_each = (
|
||||
# var.create_template ? {} : { for v in local.region_disk_tags : v.key => v }
|
||||
# )
|
||||
# parent = (
|
||||
# "${local.tag_parent_base}/regions/${local.region}/disks/${each.value.disk_id}"
|
||||
# )
|
||||
# tag_value = each.value.tag_value
|
||||
# location = local.region
|
||||
# }
|
||||
resource "google_tags_location_tag_binding" "disks_regional" {
|
||||
for_each = (
|
||||
var.create_template ? {} : { for v in local.region_disk_tags : v.key => v }
|
||||
)
|
||||
parent = (
|
||||
"${local.tag_parent_base}/regions/${local.region}/disks/${each.value.disk_id}"
|
||||
)
|
||||
tag_value = each.value.tag_value
|
||||
location = local.region
|
||||
}
|
||||
|
||||
# TODO: enable once the template id is available
|
||||
|
||||
|
||||
4
modules/compute-vm/versions.tf
generated
4
modules/compute-vm/versions.tf
generated
@@ -19,11 +19,11 @@ terraform {
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
version = ">= 6.28.0, < 7.0.0" # tftest
|
||||
version = ">= 6.33.0, < 7.0.0" # tftest
|
||||
}
|
||||
google-beta = {
|
||||
source = "hashicorp/google-beta"
|
||||
version = ">= 6.28.0, < 7.0.0" # tftest
|
||||
version = ">= 6.33.0, < 7.0.0" # tftest
|
||||
}
|
||||
}
|
||||
provider_meta "google" {
|
||||
|
||||
4
modules/compute-vm/versions.tofu
generated
4
modules/compute-vm/versions.tofu
generated
@@ -19,11 +19,11 @@ terraform {
|
||||
required_providers {
|
||||
google = {
|
||||
source = "hashicorp/google"
|
||||
version = ">= 6.28.0, < 7.0.0" # tftest
|
||||
version = ">= 6.33.0, < 7.0.0" # tftest
|
||||
}
|
||||
google-beta = {
|
||||
source = "hashicorp/google-beta"
|
||||
version = ">= 6.28.0, < 7.0.0" # tftest
|
||||
version = ">= 6.33.0, < 7.0.0" # tftest
|
||||
}
|
||||
}
|
||||
provider_meta "google" {
|
||||
|
||||
Reference in New Issue
Block a user