Skip to content

Commit

Permalink
fix: Fix Redis Tier (#103)
Browse files Browse the repository at this point in the history
* move sizing to sep file; add var to example

* default to 6g
  • Loading branch information
George Scott committed Mar 1, 2024
1 parent 5cf461c commit 432517e
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 37 deletions.
35 changes: 35 additions & 0 deletions deployment-size.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
locals {
# Specifications for t-shirt sized deployments
deployment_size = {
small = {
db = "db-n1-highmem-2",
node_count = 2,
node_instance = "n2-highmem-4"
cache = "6"
},
medium = {
db = "db-n1-highmem-4",
node_count = 2,
node_instance = "n2-highmem-4"
cache = "6"
},
large = {
db = "db-n1-highmem-8",
node_count = 2,
node_instance = "n2-highmem-8"
cache = "13"
},
xlarge = {
db = "db-n1-highmem-16",
node_count = 3,
node_instance = "n2-highmem-8"
cache = "13"
},
xxlarge = {
db = "db-n1-highmem-32",
node_count = 3,
node_instance = "n2-highmem-16"
cache = "26"
}
}
}
2 changes: 1 addition & 1 deletion examples/public-dns-with-cloud-dns/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module "wandb" {
wandb_version = var.wandb_version
wandb_image = var.wandb_image

create_redis = false
create_redis = var.create_redis
use_internal_queue = true
force_ssl = var.force_ssl

Expand Down
7 changes: 7 additions & 0 deletions examples/public-dns-with-cloud-dns/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ variable "allowed_inbound_cidrs" {
description = "Which IPv4 addresses/ranges to allow access. No default -- this must be explicitly provided."
}

variable "create_redis" {
default = false
description = "Boolean indicating whether to provision an redis instance (true) or not (false)."
nullable = false
type = bool
}

variable "project_id" {
type = string
description = "Project ID"
Expand Down
39 changes: 3 additions & 36 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,40 +27,6 @@ locals {
internal_app_port = 32543
create_bucket = var.bucket_name == ""
create_network = var.network == null

# Specifications for t-shirt sized deployments
deployment_size = {
small = {
db = "db-n1-highmem-2",
node_count = 2,
node_instance = "n2-highmem-4"
cache = "Standard 6 GB"
},
medium = {
db = "db-n1-highmem-4",
node_count = 2,
node_instance = "n2-highmem-4"
cache = "Standard 6 GB"
},
large = {
db = "db-n1-highmem-8",
node_count = 2,
node_instance = "n2-highmem-8"
cache = "Standard 13 GB"
},
xlarge = {
db = "db-n1-highmem-16",
node_count = 3,
node_instance = "n2-highmem-8"
cache = "Standard 13 GB"
},
xxlarge = {
db = "db-n1-highmem-32",
node_count = 3,
node_instance = "n2-highmem-16"
cache = "Standard 26 GB"
}
}
}

module "service_accounts" {
Expand Down Expand Up @@ -153,11 +119,12 @@ module "redis" {
count = var.create_redis ? 1 : 0
source = "./modules/redis"
namespace = var.namespace
memory_size_gb = 4
### here we set the default to 6gb, which is = setting for "small" standard size
memory_size_gb = coalesce(try(local.deployment_size[var.size].cache, 6))
network = local.network
reserved_ip_range = var.redis_reserved_ip_range
labels = var.labels
tier = coalesce(try(local.deployment_size[var.size].cache, null), var.redis_tier)
tier = var.redis_tier
}

locals {
Expand Down

0 comments on commit 432517e

Please sign in to comment.