From 4074731eee5643f1871253eab9eb76cda4ef4cb1 Mon Sep 17 00:00:00 2001 From: Lauren Huang Date: Mon, 23 Oct 2023 15:25:59 -0400 Subject: [PATCH] Add bucket_name variable. --- examples/cloud_storage/README.md | 3 ++- examples/cloud_storage/main.tf | 4 ++-- examples/cloud_storage/outputs.tf | 10 +++++----- examples/cloud_storage/variables.tf | 4 ++++ 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/examples/cloud_storage/README.md b/examples/cloud_storage/README.md index fcb8be6..9b45f25 100644 --- a/examples/cloud_storage/README.md +++ b/examples/cloud_storage/README.md @@ -8,13 +8,14 @@ This example illustrates how to use the `pubsub` module. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | project\_id | The project ID to manage the Pub/Sub resources | `string` | n/a | yes | +| bucket\_name | The name of the GCS bucket name to which to write messages | `string` | n/a | yes | ## Outputs | Name | Description | |------|-------------| | project\_id | The project ID | -| topic\_labels | The labels of the Pub/Sub topic created | +| bucket\_name | The name of the Cloud Storage bucket created | | topic\_name | The name of the Pub/Sub topic created | diff --git a/examples/cloud_storage/main.tf b/examples/cloud_storage/main.tf index a4c9f58..f2f39cc 100644 --- a/examples/cloud_storage/main.tf +++ b/examples/cloud_storage/main.tf @@ -26,7 +26,7 @@ module "pubsub" { cloud_storage_subscriptions = [ { name = "example_subscription" - bucket = "example_bucket" + bucket = var.bucket_name }, ] @@ -38,6 +38,6 @@ module "pubsub" { resource "google_storage_bucket" "test" { project = var.project_id - name = "example_bucket" + name = var.bucket_name location = "europe-west1" } diff --git a/examples/cloud_storage/outputs.tf b/examples/cloud_storage/outputs.tf index 2cd492c..48c833d 100644 --- a/examples/cloud_storage/outputs.tf +++ b/examples/cloud_storage/outputs.tf @@ -19,12 +19,12 @@ output "project_id" { description = "The project ID" } +output "bucket_name" { + value = var.bucket_name + description = "The name of the Cloud Storage bucket created" +} + output "topic_name" { value = module.pubsub.topic description = "The name of the Pub/Sub topic created" } - -output "topic_labels" { - value = module.pubsub.topic_labels - description = "The labels of the Pub/Sub topic created" -} diff --git a/examples/cloud_storage/variables.tf b/examples/cloud_storage/variables.tf index 5abd8d8..a9c54de 100644 --- a/examples/cloud_storage/variables.tf +++ b/examples/cloud_storage/variables.tf @@ -18,3 +18,7 @@ variable "project_id" { type = string description = "The project ID to manage the Pub/Sub resources" } +variable "bucket_name" { + type = string + description = "The name of the GCS bucket name to which to write messages" +}