From a0cbf5269866bfab0fdb7f0d8cb0429283867c1a Mon Sep 17 00:00:00 2001 From: Filippo Morelli Date: Thu, 9 Mar 2023 22:47:48 +0100 Subject: [PATCH] Change cache_url in redis_url --- .../terraform/environment/digitalocean-k8s/main.tf | 6 +++--- .../environment/modules/kubernetes/redis/outputs.tf | 4 ++-- .../terraform/environment/other-k8s/main.tf | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/{{cookiecutter.project_dirname}}/terraform/environment/digitalocean-k8s/main.tf b/{{cookiecutter.project_dirname}}/terraform/environment/digitalocean-k8s/main.tf index 1ab3fa78..e4061e6c 100644 --- a/{{cookiecutter.project_dirname}}/terraform/environment/digitalocean-k8s/main.tf +++ b/{{cookiecutter.project_dirname}}/terraform/environment/digitalocean-k8s/main.tf @@ -236,15 +236,15 @@ resource "kubernetes_secret_v1" "database_url" { } } -resource "kubernetes_secret_v1" "cache_url" { +resource "kubernetes_secret_v1" "redis_url" { count = var.use_redis ? 1 : 0 metadata { - name = "cache-url" + name = "redis-url" namespace = local.namespace } data = { - CACHE_URL = "${data.digitalocean_database_cluster.redis[0].private_uri}?key_prefix=${var.env_slug}" + REDIS_URL = data.digitalocean_database_cluster.redis[0].private_uri } } diff --git a/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/redis/outputs.tf b/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/redis/outputs.tf index d97f8d25..0e950b03 100644 --- a/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/redis/outputs.tf +++ b/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/redis/outputs.tf @@ -1,5 +1,5 @@ -output "cache_url" { - description = "The Redis cache url." +output "redis_url" { + description = "The Redis server URL." value = "redis://:${random_password.main.result}@${kubernetes_service_v1.main.metadata[0].name}:6379" sensitive = true } diff --git a/{{cookiecutter.project_dirname}}/terraform/environment/other-k8s/main.tf b/{{cookiecutter.project_dirname}}/terraform/environment/other-k8s/main.tf index 3e4650b1..ca36fe58 100644 --- a/{{cookiecutter.project_dirname}}/terraform/environment/other-k8s/main.tf +++ b/{{cookiecutter.project_dirname}}/terraform/environment/other-k8s/main.tf @@ -170,15 +170,15 @@ resource "kubernetes_secret_v1" "database_url" { } } -resource "kubernetes_secret_v1" "cache_url" { +resource "kubernetes_secret_v1" "redis_url" { count = var.use_redis ? 1 : 0 metadata { - name = "cache-url" + name = "redis-url" namespace = local.namespace } data = { - CACHE_URL = "${module.redis[0].cache_url}?key_prefix=${var.env_slug}" + REDIS_URL = module.redis[0].redis_url } }