diff --git a/modules/gcp-sink-sa/README.md b/modules/gcp-sink-sa/README.md index 007e87f..a9d6f09 100644 --- a/modules/gcp-sink-sa/README.md +++ b/modules/gcp-sink-sa/README.md @@ -21,4 +21,8 @@ module "gcp-sink-sa" { destination_name = "" temporal_service_account_emails = "<[...,...]>" } -``` \ No newline at end of file +``` + +NOTES: + +- for a pubsub `destination_name` use the name and not the full URN. diff --git a/modules/gcp-sink-sa/main.tf b/modules/gcp-sink-sa/main.tf index ba7890a..4fe6546 100644 --- a/modules/gcp-sink-sa/main.tf +++ b/modules/gcp-sink-sa/main.tf @@ -1,6 +1,6 @@ locals { - sa_email = tolist(var.temporal_service_account_emails)[0] - is_export = length(regexall("export-.*", local.sa_email)) > 0 + sa_email = tolist(var.temporal_service_account_emails)[0] + is_export = length(regexall("export-.*", local.sa_email)) > 0 } @@ -25,9 +25,10 @@ resource "google_storage_bucket_iam_member" "service_account_bucket_access" { } resource "google_pubsub_topic_iam_member" "service_account_pubsub_access" { - role = "roles/pubsub.publisher" - topic = var.destination_name - member = "serviceAccount:${google_service_account.gcp_sink_sa.email}" + project = var.gcp_project_id + role = "roles/pubsub.publisher" + topic = var.destination_name + member = "serviceAccount:${google_service_account.gcp_sink_sa.email}" } resource "google_service_account_iam_member" "service_account_token_creator_role" { diff --git a/modules/gcp-sink-sa/outputs.tf b/modules/gcp-sink-sa/outputs.tf new file mode 100644 index 0000000..82954b3 --- /dev/null +++ b/modules/gcp-sink-sa/outputs.tf @@ -0,0 +1,4 @@ +output "sink_service_account_email" { + description = "The Google service account used by temporalio cloud" + value = google_service_account.gcp_sink_sa.email +} diff --git a/modules/gcp-sink-sa/versions.tf b/modules/gcp-sink-sa/versions.tf index 8a1d880..b1e5831 100644 --- a/modules/gcp-sink-sa/versions.tf +++ b/modules/gcp-sink-sa/versions.tf @@ -2,7 +2,7 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = "~> 4.0" + version = "~> 6.24.0" } } -} \ No newline at end of file +}