From d4ec765d1342e3aa37e034c91f71dcb17f03129e Mon Sep 17 00:00:00 2001 From: Metrics Date: Fri, 6 Dec 2024 12:42:11 -0600 Subject: [PATCH] feat: Adding message_storage_policy to pubsub module --- modules/pubsub/main.tf | 5 +++++ modules/pubsub/variables.tf | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/modules/pubsub/main.tf b/modules/pubsub/main.tf index b8073c2a..3520d4cd 100755 --- a/modules/pubsub/main.tf +++ b/modules/pubsub/main.tf @@ -53,6 +53,11 @@ resource "google_pubsub_topic" "topic" { project = google_project_service.enable_destination_api.project labels = var.topic_labels kms_key_name = var.kms_key_name + dynamic "message_storage_policy" { + for_each = var.message_storage_policy + content { + allowed_persistence_regions = message_storage_policy.key == "allowed_persistence_regions" ? message_storage_policy.value : null + } } #--------------------------------# diff --git a/modules/pubsub/variables.tf b/modules/pubsub/variables.tf index 54fdc590..cfe51b9b 100755 --- a/modules/pubsub/variables.tf +++ b/modules/pubsub/variables.tf @@ -76,3 +76,9 @@ variable "kms_key_name" { type = string default = null } + +variable "message_storage_policy" { + type = map(any) + description = "A map of storage policies. Default - inherit from organization's Resource Location Restriction policy." + default = {} +}