add support for shared vpc host to project factory (#2300)

This commit is contained in:
Ludovico Magnocavallo 2024-05-22 09:56:34 +02:00 committed by GitHub
parent 1e149c18fc
commit ef5178c929
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 2 deletions

View File

@ -205,7 +205,7 @@ module "project-factory" {
projects_data_path = "data/projects"
}
}
# tftest modules=16 resources=55 files=prj-app-1,prj-app-2,prj-app-3,budget-test-100,h-0-0,h-1-0,h-0-1,h-1-1,h-1-1-p0 inventory=example.yaml
# tftest modules=16 resources=56 files=prj-app-1,prj-app-2,prj-app-3,budget-test-100,h-0-0,h-1-0,h-0-1,h-1-1,h-1-1-p0 inventory=example.yaml
```
A simple hierarchy of folders:
@ -326,6 +326,8 @@ iam:
- rw
"roles/viewer":
- ro
shared_vpc_host_config:
enabled: true
automation:
project: bar-baz-iac-0
service_accounts:

View File

@ -87,6 +87,14 @@ locals {
try(v.services, null),
var.data_defaults.services
)
shared_vpc_host_config = (
try(v.shared_vpc_host_config, null) != null
? merge(
{ service_projects = [] },
v.shared_vpc_host_config
)
: null
)
shared_vpc_service_config = (
try(v.shared_vpc_service_config, null) != null
? merge(

View File

@ -81,6 +81,7 @@ module "projects" {
each.value.services,
var.data_merges.services
))
shared_vpc_host_config = each.value.shared_vpc_host_config
shared_vpc_service_config = each.value.shared_vpc_service_config
tag_bindings = merge(
each.value.tag_bindings,

View File

@ -115,6 +115,7 @@ values:
counts:
google_billing_budget: 1
google_compute_shared_vpc_host_project: 1
google_compute_shared_vpc_service_project: 1
google_compute_subnetwork_iam_member: 3
google_essential_contacts_contact: 4
@ -132,4 +133,4 @@ counts:
google_storage_bucket_iam_binding: 2
google_storage_project_service_account: 4
modules: 16
resources: 55
resources: 56