Extend support for tag bindings to more modules (#2307)
* fix kms tag bindings * bigquery dataset * fix bigquery * cloud run * normalize variable type * rename gcs heading * kms example test * fix bigquery * fix cloud run * cloud run v2
This commit is contained in:
committed by
GitHub
parent
735fd79cce
commit
c80af8de66
@@ -11,6 +11,7 @@ When using an existing keyring be mindful about applying IAM bindings, as all bi
|
||||
- [Using an existing keyring](#using-an-existing-keyring)
|
||||
- [Crypto key purpose](#crypto-key-purpose)
|
||||
- [Import job](#import-job)
|
||||
- [Tag Bindings](#tag-bindings)
|
||||
- [Variables](#variables)
|
||||
- [Outputs](#outputs)
|
||||
<!-- END TOC -->
|
||||
@@ -114,6 +115,41 @@ module "kms" {
|
||||
}
|
||||
# tftest modules=1 resources=2 inventory=import-job.yaml e2e
|
||||
```
|
||||
|
||||
### Tag Bindings
|
||||
|
||||
Refer to the [Creating and managing tags](https://cloud.google.com/resource-manager/docs/tags/tags-creating-and-managing) documentation for details on usage.
|
||||
|
||||
```hcl
|
||||
module "org" {
|
||||
source = "./fabric/modules/organization"
|
||||
organization_id = var.organization_id
|
||||
tags = {
|
||||
environment = {
|
||||
description = "Environment specification."
|
||||
values = {
|
||||
dev = {}
|
||||
prod = {}
|
||||
sandbox = {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module "kms" {
|
||||
source = "./fabric/modules/kms"
|
||||
project_id = var.project_id
|
||||
keyring = {
|
||||
location = var.region
|
||||
name = "test-3"
|
||||
}
|
||||
tag_bindings = {
|
||||
env-sandbox = module.org.tag_values["environment/sandbox"].id
|
||||
}
|
||||
}
|
||||
# tftest modules=2 resources=6
|
||||
```
|
||||
|
||||
<!-- BEGIN TFDOC -->
|
||||
## Variables
|
||||
|
||||
|
||||
@@ -16,6 +16,6 @@
|
||||
|
||||
resource "google_tags_tag_binding" "binding" {
|
||||
for_each = var.tag_bindings
|
||||
parent = "//cloudresourcemanager.googleapis.com/${local.keyring.id}"
|
||||
parent = "//cloudkms.googleapis.com/${local.keyring.id}"
|
||||
tag_value = each.value
|
||||
}
|
||||
|
||||
@@ -119,6 +119,6 @@ variable "project_id" {
|
||||
variable "tag_bindings" {
|
||||
description = "Tag bindings for this keyring, in key => tag value id format."
|
||||
type = map(string)
|
||||
default = {}
|
||||
nullable = false
|
||||
default = {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user