Skip to content

Commit

Permalink
Merge pull request #279 from 20tab/feature/redis-url-secret
Browse files Browse the repository at this point in the history
Support redis url secret
  • Loading branch information
trottomv authored Apr 3, 2023
2 parents 5f0965b + f81ec11 commit 2b1e833
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ module "deployment" {

media_storage = var.media_storage

cache_url = var.cache_url
django_admins = var.django_admins
django_additional_allowed_hosts = var.django_additional_allowed_hosts
django_default_from_email = var.django_default_from_email
Expand All @@ -82,5 +83,5 @@ module "deployment" {
extra_config_values = var.extra_config_values
extra_secret_values = var.extra_secret_values

additional_secrets = var.use_redis ? ["database-url", "cache-url"] : ["database-url"]
additional_secrets = var.use_redis ? ["database-url", "redis-url"] : ["database-url"]
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
variable "cache_url" {
type = string
description = "A Django cache URL override."
default = ""
sensitive = true
}

variable "digitalocean_token" {
description = "The Digital Ocean access token."
type = string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ resource "kubernetes_deployment_v1" "main" {
}
}
}
env {
name = "CACHE_URL"
value = coalesce(var.cache_url, "$(REDIS_URL)?key_prefix=${var.environment_slug}")
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ variable "additional_secrets" {
default = []
}

variable "cache_url" {
type = string
description = "A Django cache URL override."
default = ""
sensitive = true
}

variable "django_additional_allowed_hosts" {
type = string
description = "Additional entries of the DJANGO_ALLOWED_HOSTS environment variable ('127.0.0.1', 'localhost', the service slug and the project host are included by default)."
Expand Down
3 changes: 2 additions & 1 deletion {{cookiecutter.project_dirname}}/terraform/other-k8s/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ module "deployment" {

media_persistent_volume_claim_name = var.media_storage == "local" ? kubernetes_persistent_volume_claim_v1.media[0].metadata[0].name : ""

cache_url = var.cache_url
django_admins = var.django_admins
django_additional_allowed_hosts = var.django_additional_allowed_hosts
django_default_from_email = var.django_default_from_email
Expand All @@ -110,5 +111,5 @@ module "deployment" {
extra_config_values = var.extra_config_values
extra_secret_values = var.extra_secret_values

additional_secrets = var.use_redis ? ["database-url", "cache-url"] : ["database-url"]
additional_secrets = var.use_redis ? ["database-url", "redis-url"] : ["database-url"]
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
variable "cache_url" {
type = string
description = "A Django cache URL override."
default = ""
sensitive = true
}

variable "django_additional_allowed_hosts" {
type = string
description = "Additional entries of the DJANGO_ALLOWED_HOSTS environment variable ('127.0.0.1', 'localhost', the service slug and the project host are included by default)."
Expand Down

0 comments on commit 2b1e833

Please sign in to comment.