From e63e89fe26fc935ccbda2e2a2ae13fb4b63865f6 Mon Sep 17 00:00:00 2001 From: levinandrew Date: Wed, 27 Nov 2024 14:10:03 -0800 Subject: [PATCH] feat: Configure notify-keyspace-events for redis (#180) --- modules/clickhouse/main.tf | 2 +- modules/clickhouse/variables.tf | 4 ++-- modules/redis/main.tf | 4 ++++ outputs.tf | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/clickhouse/main.tf b/modules/clickhouse/main.tf index 68018cad..3291cbd3 100644 --- a/modules/clickhouse/main.tf +++ b/modules/clickhouse/main.tf @@ -45,6 +45,6 @@ resource "google_dns_record_set" "psc_dns_record" { name = "*.${var.clickhouse_region}.p.gcp.clickhouse.cloud." managed_zone = google_dns_managed_zone.psc_dns_zone.name type = "A" - rrdatas = [ google_compute_address.psc_endpoint_ip.address ] + rrdatas = [google_compute_address.psc_endpoint_ip.address] ttl = 3600 } diff --git a/modules/clickhouse/variables.tf b/modules/clickhouse/variables.tf index 88f1a9ec..ab141166 100644 --- a/modules/clickhouse/variables.tf +++ b/modules/clickhouse/variables.tf @@ -20,7 +20,7 @@ variable "clickhouse_private_endpoint_service_name" { default = "" validation { - condition = can(regex("-clickhouse-cloud$", var.clickhouse_private_endpoint_service_name)) + condition = can(regex("-clickhouse-cloud$", var.clickhouse_private_endpoint_service_name)) error_message = "ClickHouse Service name must end in '-clickhouse-cloud'." } } @@ -31,7 +31,7 @@ variable "clickhouse_region" { default = "" validation { - condition = length(var.clickhouse_region) > 0 + condition = length(var.clickhouse_region) > 0 error_message = "Clickhouse Region should always be set if the private endpoint service name is specified." } } diff --git a/modules/redis/main.tf b/modules/redis/main.tf index 4a6ba4aa..ee78cd42 100644 --- a/modules/redis/main.tf +++ b/modules/redis/main.tf @@ -22,4 +22,8 @@ resource "google_redis_instance" "default" { auth_enabled = true labels = var.labels + + redis_configs = { + notify-keyspace-events = "K$" + } } diff --git a/outputs.tf b/outputs.tf index 242fb528..f691c649 100644 --- a/outputs.tf +++ b/outputs.tf @@ -103,5 +103,5 @@ output "sa_account_email" { output "clickhouse_private_endpoint_id" { description = "ClickHouse Private endpoint Endpoint ID to secure access inside VPC" - value = var.clickhouse_private_endpoint_service_name != "" ? module.clickhouse[0].psc_connection_id : null + value = var.clickhouse_private_endpoint_service_name != "" ? module.clickhouse[0].psc_connection_id : null }