Skip to content

Commit dc5a960

Browse files
committed
Redis Max Memory Variable
1 parent c1c61a3 commit dc5a960

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Then perform the following commands on the root folder:
114114
| postgresql\_tier | (Required) The machine type to use.Postgres supports only shared-core machine types, and custom machine types such as db-custom-2-13312 | `string` | `"db-custom-2-8192"` | no |
115115
| postgresql\_version | (Required) The PostgreSQL version to use. Supported values for Gitlab POSTGRES\_12, POSTGRES\_13. Default: POSTGRES\_12 | `string` | `"POSTGRES_12"` | no |
116116
| project\_id | GCP Project to deploy resources | `string` | n/a | yes |
117+
| redis\_maxmemory\_gb | Set a Max memory usage limit for Redis specified in GiB. | `number` | `0.8` | no |
117118
| redis\_size | Redis memory size in GiB. | `number` | `1` | no |
118119
| redis\_tier | The service tier of the instance. Must be one of these values BASIC and STANDARD\_HA | `string` | `"STANDARD_HA"` | no |
119120
| region | GCP region to deploy resources to | `string` | `"europe-west1"` | no |

main.tf

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ module "project_services" {
8383
"redis.googleapis.com",
8484
"secretmanager.googleapis.com",
8585
"containerfilesystem.googleapis.com",
86-
"storagetransfer.googleapis.com"
86+
"storagetransfer.googleapis.com",
87+
"storage.googleapis.com",
8788
]
8889
}
8990

@@ -235,15 +236,17 @@ resource "google_sql_database" "gitlabhq_production" {
235236

236237
# Redis
237238
resource "google_redis_instance" "gitlab" {
239+
display_name = "GitLab Redis"
238240
name = "gitlab"
239241
tier = var.redis_tier
240242
memory_size_gb = var.redis_size
241243
region = var.region
242244
authorized_network = google_compute_network.gitlab.self_link
245+
redis_configs = {
246+
"maxmemory-gb" = var.redis_maxmemory_gb
247+
}
243248

244249
depends_on = [module.project_services.project_id]
245-
246-
display_name = "GitLab Redis"
247250
}
248251

249252
# Cloud Storage
@@ -343,7 +346,7 @@ module "gke" {
343346
istio_auth = var.gke_istio_auth
344347

345348
cluster_autoscaling = var.gke_cluster_autoscaling
346-
349+
347350
node_pools = [
348351
{
349352
name = "gitlab"

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ variable "redis_size" {
115115
default = 1
116116
}
117117

118+
variable "redis_maxmemory_gb" {
119+
type = number
120+
description = "Set a Max memory usage limit for Redis specified in GiB."
121+
default = 0.8
122+
}
123+
118124
##################
119125
# GCS SECTION #
120126
##################

0 commit comments

Comments
 (0)