From dc74494c631e8aa216379949dedbb70dffd2855b Mon Sep 17 00:00:00 2001 From: Jieyu Tian Date: Wed, 23 Oct 2024 13:49:35 -0400 Subject: [PATCH] fix: Add Apphub URI output to Redis (#245) Co-authored-by: abhishek kumar tiwari --- README.md | 1 + metadata.yaml | 6 ++++++ outputs.tf | 8 ++++++++ 3 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 1b494e5..58fe3ea 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ module "memorystore" { | Name | Description | |------|-------------| +| apphub\_service\_uri | Service URI in CAIS style to be used by Apphub. | | auth\_string | AUTH String set on the instance. This field will only be populated if auth\_enabled is true. | | current\_location\_id | The current zone where the Redis endpoint is placed. | | env\_vars | Exported environment variables | diff --git a/metadata.yaml b/metadata.yaml index 50c3b28..383072d 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -150,6 +150,12 @@ spec: rdb_snapshot_period = string }) outputs: + - name: apphub_service_uri + description: Service URI in CAIS style to be used by Apphub. + type: + - object + - service_id: string + service_uri: string - name: auth_string description: AUTH String set on the instance. This field will only be populated if auth_enabled is true. type: string diff --git a/outputs.tf b/outputs.tf index e372425..8d4f979 100644 --- a/outputs.tf +++ b/outputs.tf @@ -68,3 +68,11 @@ output "env_vars" { "REDIS_PORT" : tostring(google_redis_instance.default.port) } } + +output "apphub_service_uri" { + value = { + service_uri = "//redis.googleapis.com/${google_redis_instance.default.id}" + service_id = substr("${var.name}-${md5("${var.region}-${var.project_id}")}", 0, 63) + } + description = "Service URI in CAIS style to be used by Apphub." +}