forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add RDB & AOF Persistence support to Memorystore for Redis Cluster (G…
- Loading branch information
1 parent
0b5a61a
commit edfc70b
Showing
4 changed files
with
273 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
mmv1/templates/terraform/examples/redis_cluster_aof.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
resource "google_redis_cluster" "{{$.PrimaryResourceId}}" { | ||
name = "{{index $.Vars "cluster_name"}}" | ||
shard_count = 3 | ||
psc_configs { | ||
network = google_compute_network.producer_net.id | ||
} | ||
region = "us-central1" | ||
replica_count = 0 | ||
node_type = "REDIS_SHARED_CORE_NANO" | ||
transit_encryption_mode = "TRANSIT_ENCRYPTION_MODE_DISABLED" | ||
authorization_mode = "AUTH_MODE_DISABLED" | ||
redis_configs = { | ||
maxmemory-policy = "volatile-ttl" | ||
} | ||
deletion_protection_enabled = {{index $.Vars "deletion_protection_enabled"}} | ||
|
||
zone_distribution_config { | ||
mode = "MULTI_ZONE" | ||
} | ||
maintenance_policy { | ||
weekly_maintenance_window { | ||
day = "MONDAY" | ||
start_time { | ||
hours = 1 | ||
minutes = 0 | ||
seconds = 0 | ||
nanos = 0 | ||
} | ||
} | ||
} | ||
persistence_config { | ||
mode = "AOF" | ||
aof_config { | ||
append_fsync = "EVERYSEC" | ||
} | ||
} | ||
depends_on = [ | ||
google_network_connectivity_service_connection_policy.default | ||
] | ||
} | ||
|
||
resource "google_network_connectivity_service_connection_policy" "default" { | ||
name = "{{index $.Vars "policy_name"}}" | ||
location = "us-central1" | ||
service_class = "gcp-memorystore-redis" | ||
description = "my basic service connection policy" | ||
network = google_compute_network.producer_net.id | ||
psc_config { | ||
subnetworks = [google_compute_subnetwork.producer_subnet.id] | ||
} | ||
} | ||
|
||
resource "google_compute_subnetwork" "producer_subnet" { | ||
name = "{{index $.Vars "subnet_name"}}" | ||
ip_cidr_range = "10.0.0.248/29" | ||
region = "us-central1" | ||
network = google_compute_network.producer_net.id | ||
} | ||
|
||
resource "google_compute_network" "producer_net" { | ||
name = "{{index $.Vars "network_name"}}" | ||
auto_create_subnetworks = false | ||
} |
64 changes: 64 additions & 0 deletions
64
mmv1/templates/terraform/examples/redis_cluster_rdb.tf.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
resource "google_redis_cluster" "{{$.PrimaryResourceId}}" { | ||
name = "{{index $.Vars "cluster_name"}}" | ||
shard_count = 3 | ||
psc_configs { | ||
network = google_compute_network.producer_net.id | ||
} | ||
region = "us-central1" | ||
replica_count = 0 | ||
node_type = "REDIS_SHARED_CORE_NANO" | ||
transit_encryption_mode = "TRANSIT_ENCRYPTION_MODE_DISABLED" | ||
authorization_mode = "AUTH_MODE_DISABLED" | ||
redis_configs = { | ||
maxmemory-policy = "volatile-ttl" | ||
} | ||
deletion_protection_enabled = {{index $.Vars "deletion_protection_enabled"}} | ||
|
||
zone_distribution_config { | ||
mode = "MULTI_ZONE" | ||
} | ||
maintenance_policy { | ||
weekly_maintenance_window { | ||
day = "MONDAY" | ||
start_time { | ||
hours = 1 | ||
minutes = 0 | ||
seconds = 0 | ||
nanos = 0 | ||
} | ||
} | ||
} | ||
persistence_config { | ||
mode = "RDB" | ||
rdb_config { | ||
rdb_snapshot_period = "ONE_HOUR" | ||
rdb_snapshot_start_time = "2024-10-02T15:01:23Z" | ||
} | ||
} | ||
depends_on = [ | ||
google_network_connectivity_service_connection_policy.default | ||
] | ||
} | ||
|
||
resource "google_network_connectivity_service_connection_policy" "default" { | ||
name = "{{index $.Vars "policy_name"}}" | ||
location = "us-central1" | ||
service_class = "gcp-memorystore-redis" | ||
description = "my basic service connection policy" | ||
network = google_compute_network.producer_net.id | ||
psc_config { | ||
subnetworks = [google_compute_subnetwork.producer_subnet.id] | ||
} | ||
} | ||
|
||
resource "google_compute_subnetwork" "producer_subnet" { | ||
name = "{{index $.Vars "subnet_name"}}" | ||
ip_cidr_range = "10.0.0.248/29" | ||
region = "us-central1" | ||
network = google_compute_network.producer_net.id | ||
} | ||
|
||
resource "google_compute_network" "producer_net" { | ||
name = "{{index $.Vars "network_name"}}" | ||
auto_create_subnetworks = false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters