Skip to content

Commit bbd56c6

Browse files
Platform/3048 add dumps bucket (#18)
* refs platform/3048: fix tags depends_on * feat: add generated buckets output * Update CHANGELOG.md Co-authored-by: Andrea Panisson <andrea.panisson@sparkfabrik.com> * Update outputs.tf Co-authored-by: Andrea Panisson <andrea.panisson@sparkfabrik.com> * fix --------- Co-authored-by: Andrea Panisson <andrea.panisson@sparkfabrik.com>
1 parent b52116b commit bbd56c6

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres
77
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
# [0.7.2] - 2024-08-07
10+
11+
[Compare with previous version](https://github.com/sparkfabrik/terraform-google-gcp-application-bucket-creation-helper/compare/0.7.1...0.7.2)
12+
13+
- Added an output with the list of bucket names generated by the module.
14+
915
# [0.7.1] - 2023-08-09
1016

1117
[Compare with previous version](https://github.com/sparkfabrik/terraform-google-gcp-application-bucket-creation-helper/compare/0.7.0...0.7.1)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ want to import existing buckets with a known name.
9898
| <a name="output_buckets_access_credentials"></a> [buckets\_access\_credentials](#output\_buckets\_access\_credentials) | Access credentials for the application buckets |
9999
| <a name="output_details_of_used_tag_keys"></a> [details\_of\_used\_tag\_keys](#output\_details\_of\_used\_tag\_keys) | Details of all the tag keys passed to this module (globals and per bucket). |
100100
| <a name="output_details_of_used_tag_values"></a> [details\_of\_used\_tag\_values](#output\_details\_of\_used\_tag\_values) | Details of all the tag values passed to this module (globals and per bucket). |
101+
| <a name="output_generated_bucket_names"></a> [generated\_bucket\_names](#output\_generated\_bucket\_names) | The list with the names of the buckets managed by this module. |
101102
## Resources
102103

103104
| Name | Type |

main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ locals {
7777
bucket_name = local.generated_bucket_names[bucket.name]
7878
bucket_location = bucket.location != null ? bucket.location : local.default_region
7979
# If the bucket has no tags, we add the global tags, otherwise we use the bucket tags.
80-
tag_list = length(bucket.tag_list) > 0 ? bucket.tag_list : var.global_tags
80+
tag_list = length(bucket.tag_list) > 0 ? bucket.tag_list : var.global_tags
8181
}
8282
]
8383

@@ -124,10 +124,11 @@ data "google_tags_tag_value" "tag_values" {
124124

125125
# Bind tags to buckets.
126126
resource "google_tags_location_tag_binding" "binding" {
127-
for_each = local.map_of_buckets_to_be_tagged
128-
parent = "//storage.googleapis.com/projects/_/buckets/${each.value.bucket_name}"
129-
location = each.value.bucket_location
130-
tag_value = data.google_tags_tag_value.tag_values[each.value.tag_friendly_name].id
127+
for_each = local.map_of_buckets_to_be_tagged
128+
parent = "//storage.googleapis.com/projects/_/buckets/${each.value.bucket_name}"
129+
location = each.value.bucket_location
130+
tag_value = data.google_tags_tag_value.tag_values[each.value.tag_friendly_name].id
131+
depends_on = [google_storage_bucket.application, google_storage_bucket.disaster_recovery]
131132
}
132133

133134
# -------------------------------

outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,8 @@ output "details_of_used_tag_values" {
2020
description = "Details of all the tag values passed to this module (globals and per bucket)."
2121
value = data.google_tags_tag_value.tag_values
2222
}
23+
24+
output "generated_bucket_names" {
25+
description = "The list with the names of the buckets managed by this module."
26+
value = local.generated_bucket_names
27+
}

0 commit comments

Comments
 (0)