Expose tags in project factory (#2929)
* Expose tags in project factory * Update readme * Remove default and update schema * Fix tests
This commit is contained in:
@@ -378,6 +378,16 @@ shared_vpc_service_config:
|
||||
- container-engine
|
||||
billing_budgets:
|
||||
- test-100
|
||||
tags:
|
||||
my-tag-key-1:
|
||||
values:
|
||||
my-value-1:
|
||||
description: My value 1
|
||||
my-value-2:
|
||||
description: My value 3
|
||||
iam:
|
||||
roles/resourcemanager.tagUser:
|
||||
- user:user@example.com
|
||||
# tftest-file id=6 path=data/projects/dev-ta-app0-be.yaml schema=project.schema.json
|
||||
```
|
||||
|
||||
|
||||
@@ -145,6 +145,24 @@ locals {
|
||||
try(v.tag_bindings, null),
|
||||
var.data_defaults.tag_bindings
|
||||
)
|
||||
tags = {
|
||||
for tag_name, tag_data in try(v.tags, {}) : tag_name => {
|
||||
description = try(tag_data.description, "Managed by the Terraform project-factory module.")
|
||||
id = try(tag_data.id, null)
|
||||
iam = try(tag_data.iam, {})
|
||||
iam_bindings = try(tag_data.iam_bindings, {})
|
||||
iam_bindings_additive = try(tag_data.iam_bindings_additive, {})
|
||||
values = {
|
||||
for value_name, value_data in try(tag_data.values, {}) : value_name => {
|
||||
description = try(value_data.description, "Managed by the Terraform project-factory module.")
|
||||
id = try(value_data.id, null)
|
||||
iam = try(value_data.iam, {})
|
||||
iam_bindings = try(value_data.iam_bindings, {})
|
||||
iam_bindings_additive = try(value_data.iam_bindings_additive, {})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
vpc_sc = (
|
||||
var.data_overrides.vpc_sc != null
|
||||
? var.data_overrides.vpc_sc
|
||||
|
||||
@@ -87,6 +87,7 @@ module "projects" {
|
||||
for k, v in merge(each.value.tag_bindings, var.data_merges.tag_bindings) :
|
||||
k => lookup(var.factories_config.context.tag_values, v, v)
|
||||
}
|
||||
tags = each.value.tags
|
||||
vpc_sc = each.value.vpc_sc
|
||||
}
|
||||
|
||||
|
||||
@@ -319,6 +319,54 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"iam": {
|
||||
"$ref": "#/$defs/iam"
|
||||
},
|
||||
"iam_bindings": {
|
||||
"$ref": "#/$defs/iam_bindings"
|
||||
},
|
||||
"iam_bindings_additive": {
|
||||
"$ref": "#/$defs/iam_bindings_additive"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"values": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"iam": {
|
||||
"$ref": "#/$defs/iam"
|
||||
},
|
||||
"iam_bindings": {
|
||||
"$ref": "#/$defs/iam_bindings"
|
||||
},
|
||||
"iam_bindings_additive": {
|
||||
"$ref": "#/$defs/iam_bindings_additive"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"vpc_sc": {
|
||||
"type": "object",
|
||||
"additionalItems": false,
|
||||
@@ -570,4 +618,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2023 Google LLC
|
||||
* Copyright 2025 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -515,6 +515,6 @@ counts:
|
||||
google_storage_project_service_account: 4
|
||||
google_tags_tag_binding: 1
|
||||
modules: 20
|
||||
resources: 70
|
||||
resources: 74
|
||||
|
||||
outputs: {}
|
||||
|
||||
Reference in New Issue
Block a user