From 910f4db7e2074986e643098231c36ca068c50dc8 Mon Sep 17 00:00:00 2001 From: Joshua Wright Date: Mon, 28 Oct 2024 09:27:19 +0000 Subject: [PATCH 1/5] Add Automation Service Accounts Output --- fast/stages/2-project-factory/outputs.tf | 5 +++++ modules/project-factory/README.md | 1 + modules/project-factory/outputs.tf | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/fast/stages/2-project-factory/outputs.tf b/fast/stages/2-project-factory/outputs.tf index baaf390290..7e8d3866b4 100644 --- a/fast/stages/2-project-factory/outputs.tf +++ b/fast/stages/2-project-factory/outputs.tf @@ -28,3 +28,8 @@ output "service_accounts" { description = "Created service accounts." value = module.projects.service_accounts } + +output "automation_service_accounts" { + description = "Created Automation Service Accounts." + value = module.projects.automation_service_accounts +} diff --git a/modules/project-factory/README.md b/modules/project-factory/README.md index 478dc984bf..bc4aeb6e85 100644 --- a/modules/project-factory/README.md +++ b/modules/project-factory/README.md @@ -448,6 +448,7 @@ update_rules: | name | description | sensitive | |---|---|:---:| +| [automation_service_accounts](outputs.tf#L34) | Automation Service Accounts | | | [folders](outputs.tf#L17) | Folder ids. | | | [projects](outputs.tf#L22) | Project module outputs. | | | [service_accounts](outputs.tf#L27) | Service account emails. | | diff --git a/modules/project-factory/outputs.tf b/modules/project-factory/outputs.tf index 5040e76671..e33b97d734 100644 --- a/modules/project-factory/outputs.tf +++ b/modules/project-factory/outputs.tf @@ -30,3 +30,11 @@ output "service_accounts" { for k, v in module.service-accounts : k => v.email } } + +output "automation_service_accounts" { + description = "Automation Service Accounts" + # value = module.automation-service-accounts + value = { + for k, v in module.automation-service-accounts : k => v.email + } +} From 2578d03b9b9000fc1538cd2631dcb363707f0705 Mon Sep 17 00:00:00 2001 From: Joshua Wright Date: Mon, 28 Oct 2024 09:28:36 +0000 Subject: [PATCH 2/5] Add Automation Service Accounts Output --- modules/project-factory/outputs.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/project-factory/outputs.tf b/modules/project-factory/outputs.tf index e33b97d734..580436c0d0 100644 --- a/modules/project-factory/outputs.tf +++ b/modules/project-factory/outputs.tf @@ -33,7 +33,6 @@ output "service_accounts" { output "automation_service_accounts" { description = "Automation Service Accounts" - # value = module.automation-service-accounts value = { for k, v in module.automation-service-accounts : k => v.email } From 0cb04bf78f8bd1393d6ec4ff494506614a037bba Mon Sep 17 00:00:00 2001 From: Joshua Wright Date: Mon, 28 Oct 2024 11:01:00 +0000 Subject: [PATCH 3/5] Add Projects Output, Along with Docs --- fast/stages/2-project-factory/README.md | 2 +- fast/stages/2-project-factory/outputs.tf | 12 +---------- modules/project-factory/README.md | 6 +++--- modules/project-factory/outputs.tf | 26 ++++++++++++++++-------- 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/fast/stages/2-project-factory/README.md b/fast/stages/2-project-factory/README.md index f1ab1d6e80..e47ee38d90 100644 --- a/fast/stages/2-project-factory/README.md +++ b/fast/stages/2-project-factory/README.md @@ -353,5 +353,5 @@ The approach is not shown here but reasonably easy to implement. The main projec | name | description | sensitive | consumers | |---|---|:---:|---| | [projects](outputs.tf#L17) | Created projects. | | | -| [service_accounts](outputs.tf#L27) | Created service accounts. | | | +| [service_accounts](outputs.tf#L22) | Created service accounts. | | | diff --git a/fast/stages/2-project-factory/outputs.tf b/fast/stages/2-project-factory/outputs.tf index 7e8d3866b4..2c86ac9c96 100644 --- a/fast/stages/2-project-factory/outputs.tf +++ b/fast/stages/2-project-factory/outputs.tf @@ -16,20 +16,10 @@ output "projects" { description = "Created projects." - value = { - for k, v in module.projects.projects : k => { - number = v.number - project_id = v.id - } - } + value = module.projects.projects } output "service_accounts" { description = "Created service accounts." value = module.projects.service_accounts } - -output "automation_service_accounts" { - description = "Created Automation Service Accounts." - value = module.projects.automation_service_accounts -} diff --git a/modules/project-factory/README.md b/modules/project-factory/README.md index bc4aeb6e85..556e498ad2 100644 --- a/modules/project-factory/README.md +++ b/modules/project-factory/README.md @@ -448,10 +448,10 @@ update_rules: | name | description | sensitive | |---|---|:---:| -| [automation_service_accounts](outputs.tf#L34) | Automation Service Accounts | | | [folders](outputs.tf#L17) | Folder ids. | | -| [projects](outputs.tf#L22) | Project module outputs. | | -| [service_accounts](outputs.tf#L27) | Service account emails. | | +| [projects](outputs.tf#L22) | Created projects. | | +| [service_accounts](outputs.tf#L42) | Service account emails. | | + ## Tests diff --git a/modules/project-factory/outputs.tf b/modules/project-factory/outputs.tf index 580436c0d0..102ce9ed5e 100644 --- a/modules/project-factory/outputs.tf +++ b/modules/project-factory/outputs.tf @@ -20,8 +20,23 @@ output "folders" { } output "projects" { - description = "Project module outputs." - value = module.projects + description = "Created projects." + value = { + for k, v in module.projects.projects : k => { + number = v.number + project_id = v.id + automation_buckets = { + for kk, vv in module.projects.automation_buckets : + trimprefix(kk, "${k}/") => vv.name + if startswith(kk, "${k}/") + } + automation_service_accounts = { + for kk, vv in module.projects.automation_service_accounts : + trimprefix(kk, "${k}/") => vv.email + if startswith(kk, "${k}/") + } + } + } } output "service_accounts" { @@ -30,10 +45,3 @@ output "service_accounts" { for k, v in module.service-accounts : k => v.email } } - -output "automation_service_accounts" { - description = "Automation Service Accounts" - value = { - for k, v in module.automation-service-accounts : k => v.email - } -} From 9fd6188aa80565beeff67dc0fb4722467dcb8c7c Mon Sep 17 00:00:00 2001 From: Julio Castillo Date: Sun, 17 Nov 2024 18:14:37 +0100 Subject: [PATCH 4/5] Fix output --- modules/project-factory/outputs.tf | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/project-factory/outputs.tf b/modules/project-factory/outputs.tf index 102ce9ed5e..a8e108327d 100644 --- a/modules/project-factory/outputs.tf +++ b/modules/project-factory/outputs.tf @@ -1,5 +1,5 @@ /** - * Copyright 2023 Google LLC + * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,16 +22,17 @@ output "folders" { output "projects" { description = "Created projects." value = { - for k, v in module.projects.projects : k => { + for k, v in module.projects : k => { number = v.number project_id = v.id + project = v automation_buckets = { - for kk, vv in module.projects.automation_buckets : + for kk, vv in module.automation-buckets : trimprefix(kk, "${k}/") => vv.name if startswith(kk, "${k}/") } automation_service_accounts = { - for kk, vv in module.projects.automation_service_accounts : + for kk, vv in module.automation-service-accounts : trimprefix(kk, "${k}/") => vv.email if startswith(kk, "${k}/") } From fa5e75e78c0d4795f760025431028bcf10395ce8 Mon Sep 17 00:00:00 2001 From: Julio Castillo Date: Sun, 17 Nov 2024 18:17:04 +0100 Subject: [PATCH 5/5] Fix docs --- modules/project-factory/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/project-factory/README.md b/modules/project-factory/README.md index faed1b93f0..ddb7bba4dd 100644 --- a/modules/project-factory/README.md +++ b/modules/project-factory/README.md @@ -450,8 +450,7 @@ update_rules: |---|---|:---:| | [folders](outputs.tf#L17) | Folder ids. | | | [projects](outputs.tf#L22) | Created projects. | | -| [service_accounts](outputs.tf#L42) | Service account emails. | | - +| [service_accounts](outputs.tf#L43) | Service account emails. | | ## Tests