Skip to content

Commit

Permalink
Allow cache url override
Browse files Browse the repository at this point in the history
  • Loading branch information
filippo-20tab committed Mar 31, 2023
1 parent 89a8283 commit f81ec11
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 3 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 Down
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 @@ -132,11 +132,11 @@ resource "kubernetes_deployment_v1" "main" {
name = var.service_slug
resources {
limits = {
cpu = var.service_limits_cpu
cpu = var.service_limits_cpu
memory = var.service_limits_memory
}
requests = {
cpu = var.service_requests_cpu
cpu = var.service_requests_cpu
memory = var.service_requests_memory
}
}
Expand Down Expand Up @@ -171,7 +171,7 @@ resource "kubernetes_deployment_v1" "main" {
}
env {
name = "CACHE_URL"
value = "$(REDIS_URL)?key_prefix=${var.environment_slug}"
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
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,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 Down
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 f81ec11

Please sign in to comment.