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

Fix tag outputs in organization module #1012

Merged
merged 1 commit into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions modules/organization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,10 @@ module "org" {
| [firewall_policies](outputs.tf#L35) | Map of firewall policy resources created in the organization. | |
| [firewall_policy_id](outputs.tf#L40) | Map of firewall policy ids created in the organization. | |
| [network_tag_keys](outputs.tf#L45) | Tag key resources. | |
| [network_tag_values](outputs.tf#L52) | Tag value resources. | |
| [organization_id](outputs.tf#L60) | Organization id dependent on module resources. | |
| [sink_writer_identities](outputs.tf#L77) | Writer identities created for each sink. | |
| [tag_keys](outputs.tf#L85) | Tag key resources. | |
| [tag_values](outputs.tf#L92) | Tag value resources. | |
| [network_tag_values](outputs.tf#L54) | Tag value resources. | |
| [organization_id](outputs.tf#L65) | Organization id dependent on module resources. | |
| [sink_writer_identities](outputs.tf#L82) | Writer identities created for each sink. | |
| [tag_keys](outputs.tf#L90) | Tag key resources. | |
| [tag_values](outputs.tf#L99) | Tag value resources. | |

<!-- END TFDOC -->
18 changes: 14 additions & 4 deletions modules/organization/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,20 @@ output "firewall_policy_id" {
output "network_tag_keys" {
description = "Tag key resources."
value = {
for k, v in google_tags_tag_key.default : k => v if v.purpose != null
for k, v in google_tags_tag_key.default : k => v if(
v.purpose != null && v.purpose != ""
)
}
}

output "network_tag_values" {
description = "Tag value resources."
value = {
for k, v in google_tags_tag_value.default
: k => v if google_tags_tag_key.default[split("/", k)[0]].purpose != null
: k => v if(
google_tags_tag_key.default[split("/", k)[0]].purpose != null &&
google_tags_tag_key.default[split("/", k)[0]].purpose != ""
)
}
}

Expand Down Expand Up @@ -85,14 +90,19 @@ output "sink_writer_identities" {
output "tag_keys" {
description = "Tag key resources."
value = {
for k, v in google_tags_tag_key.default : k => v if v.purpose == null
for k, v in google_tags_tag_key.default : k => v if(
v.purpose == null || v.purpose == ""
)
}
}

output "tag_values" {
description = "Tag value resources."
value = {
for k, v in google_tags_tag_value.default
: k => v if google_tags_tag_key.default[split("/", k)[0]].purpose == null
: k => v if(
google_tags_tag_key.default[split("/", k)[0]].purpose == null ||
google_tags_tag_key.default[split("/", k)[0]].purpose == ""
)
}
}