Skip to content

Commit 5c13494

Browse files
sANGINI2004Sangini Gargq2w
authored
chore: add connection-metadata to Redis Cluster's metadata.yaml for ADC compliance (#310)
Co-authored-by: Sangini Garg <[email protected]> Co-authored-by: abhishek kumar tiwari <[email protected]>
1 parent 47910c2 commit 5c13494

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

modules/redis-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Check the [example/](https://github.com/terraform-google-modules/terraform-googl
6161
|------|-------------|
6262
| apphub\_service\_uri | Service URI in CAIS style to be used by Apphub. |
6363
| discovery\_endpoints | Endpoints created on each given network, for Redis clients to connect to the cluster. Currently only one endpoint is supported |
64+
| env\_vars | Environment variables for Redis cluster connection, including address and port. |
6465
| id | The redis cluster instance ID |
6566
| psc\_connections | PSC connections for discovery of the cluster topology and accessing the cluster |
6667
| psc\_service\_attachments | The PSC service attachments of the cluster |

modules/redis-cluster/metadata.display.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ spec:
3131
authorization_mode:
3232
name: authorization_mode
3333
title: Authorization Mode
34+
altDefaults:
35+
- type: ALTERNATE_TYPE_DC
36+
value: AUTH_MODE_IAM_AUTH
3437
cluster_role:
3538
name: cluster_role
3639
title: Cluster Role

modules/redis-cluster/metadata.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ spec:
8282
description: List of consumer network where the network address of the discovery endpoint will be reserved, in the form of projects/{network_project_id_or_number}/global/networks/{network_id}. Currently, only one item is supported
8383
varType: list(string)
8484
required: true
85+
connections:
86+
- source:
87+
source: github.com/terraform-google-modules/terraform-google-network//modules/vpc
88+
version: ">= 9.1.0"
89+
spec:
90+
outputExpr: network_id
8591
- name: service_connection_policies
8692
description: The Service Connection Policies to create
8793
varType: |-
@@ -174,6 +180,12 @@ spec:
174180
- list
175181
- - object
176182
- network: string
183+
- name: env_vars
184+
description: Environment variables for Redis cluster connection, including address and port.
185+
type:
186+
- object
187+
- REDIS_CLUSTER_HOST: string
188+
REDIS_CLUSTER_PORT: string
177189
- name: id
178190
description: The redis cluster instance ID
179191
type: string

modules/redis-cluster/outputs.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ output "redis_cluster" {
3939
value = google_redis_cluster.redis_cluster
4040
}
4141

42+
output "env_vars" {
43+
description = "Environment variables for Redis cluster connection, including address and port."
44+
value = {
45+
"REDIS_CLUSTER_HOST" = google_redis_cluster.redis_cluster.discovery_endpoints[0].address
46+
"REDIS_CLUSTER_PORT" = tostring(google_redis_cluster.redis_cluster.discovery_endpoints[0].port)
47+
}
48+
}
49+
4250
output "apphub_service_uri" {
4351
value = {
4452
service_uri = "//redis.googleapis.com/${google_redis_cluster.redis_cluster.id}"

0 commit comments

Comments
 (0)