Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Automation Service Accounts Output #2640

Merged
merged 7 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fast/stages/2-project-factory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. | | |
<!-- END TFDOC -->
7 changes: 1 addition & 6 deletions fast/stages/2-project-factory/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@

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" {
Expand Down
5 changes: 3 additions & 2 deletions modules/project-factory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,9 @@ update_rules:
| name | description | sensitive |
|---|---|:---:|
| [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. | |

<!-- END TFDOC -->
## Tests

Expand Down
19 changes: 17 additions & 2 deletions modules/project-factory/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
Loading