Skip to content

Commit 2cd04ba

Browse files
committed
Use variables instead of hardcoded values
These variables can be changed in the API repo, while everything else is backwards compatible.
1 parent 80f9437 commit 2cd04ba

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

google/redis/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ resource "google_redis_instance" "main" {
77
region = var.region
88
name = var.name
99

10-
redis_version = "REDIS_7_2"
10+
redis_version = var.version
1111

12-
memory_size_gb = 2
12+
memory_size_gb = var.memory
1313

1414
authorized_network = var.network
1515
connect_mode = "PRIVATE_SERVICE_ACCESS"
1616

1717
auth_enabled = true
1818

1919
persistence_config {
20-
persistence_mode = "RDB"
21-
rdb_snapshot_period = "ONE_HOUR"
20+
persistence_mode = var.persistence_mode
21+
rdb_snapshot_period = var.persistence_period
2222
}
2323

2424
depends_on = [

google/redis/variables.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,23 @@ variable "cluster" {
3434
variable "network" {
3535
type = string
3636
}
37+
38+
variable "version" {
39+
type = string
40+
default = "REDIS_7_2"
41+
}
42+
43+
variable "memory" {
44+
type = number
45+
default = 2
46+
}
47+
48+
variable "persistence_mode" {
49+
type = string
50+
default = "RDB"
51+
}
52+
53+
variable "persistence_period" {
54+
type = string
55+
default = "ONE_HOUR"
56+
}

0 commit comments

Comments
 (0)