Added tag factory option for organization module (#3178)

* Added tag factory option for organization module

* added tags-factory tests

* added tag factory for project module

* missing header

* added lookup catch for org tag values and fixed incorrect link in doco

* fixed factory locals from copy/paste

* added full doco/tests for project tags factory. fixed failed test looking for ID in yamls

* added context option for factories_config to configure existing K/Vs

---------

Co-authored-by: Ludovico Magnocavallo <ludomagno@google.com>
This commit is contained in:
Liam Nesteroff
2025-06-23 16:24:43 +10:00
committed by GitHub
parent 1dde5258fa
commit 1fbb2cb330
8 changed files with 335 additions and 59 deletions

View File

@@ -0,0 +1,42 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
values:
module.org.google_tags_tag_key.default["cost-center"]:
description: Tag for internal cost allocation.
parent: organizations/1122334455
purpose: null
purpose_data: null
short_name: cost-center
timeouts: null
module.org.google_tags_tag_key_iam_binding.default["cost-center:roles/resourcemanager.tagViewer"]:
condition: []
members:
- group:finance-team@example.com
role: roles/resourcemanager.tagViewer
module.org.google_tags_tag_value.default["cost-center/engineering"]:
description: Engineering department.
short_name: engineering
timeouts: null
module.org.google_tags_tag_value.default["cost-center/marketing"]:
description: "Marketing department."
short_name: marketing
timeouts: null
counts:
google_tags_tag_key: 1
google_tags_tag_key_iam_binding: 1
google_tags_tag_value: 2
modules: 1
resources: 4

View File

@@ -0,0 +1,53 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
values:
module.project.google_project.project[0]:
auto_create_network: false
billing_account: 123456-123456-123456
deletion_policy: 'DELETE'
folder_id: '1122334455'
labels: null
name: test-project
org_id: null
project_id: test-project
timeouts: null
module.project.google_tags_tag_key.default["workloads"]:
description: Tag for workload classifications.
parent: projects/test-project
purpose: null
purpose_data: null
short_name: workloads
timeouts: null
module.project.google_tags_tag_key_iam_binding.default["workloads:roles/resourcemanager.tagViewer"]:
condition: []
members:
- group:devops@example.com
role: roles/resourcemanager.tagViewer
module.project.google_tags_tag_value.default["workloads/frontend"]:
description: "Frontend workloads."
short_name: frontend
timeouts: null
module.project.google_tags_tag_value.default["workloads/backend"]:
description: "Backend workloads."
short_name: backend
timeouts: null
counts:
google_project: 1
google_tags_tag_key: 1
google_tags_tag_key_iam_binding: 1
google_tags_tag_value: 2
modules: 1
resources: 5