|
| 1 | +resource "google_memorystore_instance" "instance-full" { |
| 2 | + instance_id = "full-instance-${local.name_suffix}" |
| 3 | + shard_count = 3 |
| 4 | + desired_psc_auto_connections { |
| 5 | + network = google_compute_network.producer_net.id |
| 6 | + project_id = data.google_project.project.project_id |
| 7 | + } |
| 8 | + location = "us-central1" |
| 9 | + replica_count = 2 |
| 10 | + node_type = "SHARED_CORE_NANO" |
| 11 | + transit_encryption_mode = "TRANSIT_ENCRYPTION_DISABLED" |
| 12 | + authorization_mode = "AUTH_DISABLED" |
| 13 | + engine_configs = { |
| 14 | + maxmemory-policy = "volatile-ttl" |
| 15 | + } |
| 16 | + zone_distribution_config { |
| 17 | + mode = "SINGLE_ZONE" |
| 18 | + zone = "us-central1-b" |
| 19 | + } |
| 20 | + engine_version = "VALKEY_7_2" |
| 21 | + deletion_protection_enabled = false |
| 22 | + mode = "CLUSTER" |
| 23 | + persistence_config { |
| 24 | + mode = "RDB" |
| 25 | + rdb_config { |
| 26 | + rdb_snapshot_period = "ONE_HOUR" |
| 27 | + rdb_snapshot_start_time = "2024-10-02T15:01:23Z" |
| 28 | + } |
| 29 | + } |
| 30 | + labels = { |
| 31 | + "abc" : "xyz" |
| 32 | + } |
| 33 | + depends_on = [ |
| 34 | + google_network_connectivity_service_connection_policy.default |
| 35 | + ] |
| 36 | + |
| 37 | + lifecycle { |
| 38 | + prevent_destroy = "true-${local.name_suffix}" |
| 39 | + } |
| 40 | +} |
| 41 | + |
| 42 | +resource "google_network_connectivity_service_connection_policy" "default" { |
| 43 | + name = "my-policy-${local.name_suffix}" |
| 44 | + location = "us-central1" |
| 45 | + service_class = "gcp-memorystore" |
| 46 | + description = "my basic service connection policy" |
| 47 | + network = google_compute_network.producer_net.id |
| 48 | + psc_config { |
| 49 | + subnetworks = [google_compute_subnetwork.producer_subnet.id] |
| 50 | + } |
| 51 | +} |
| 52 | + |
| 53 | +resource "google_compute_subnetwork" "producer_subnet" { |
| 54 | + name = "my-subnet-${local.name_suffix}" |
| 55 | + ip_cidr_range = "10.0.0.248/29" |
| 56 | + region = "us-central1" |
| 57 | + network = google_compute_network.producer_net.id |
| 58 | +} |
| 59 | + |
| 60 | +resource "google_compute_network" "producer_net" { |
| 61 | + name = "my-network-${local.name_suffix}" |
| 62 | + auto_create_subnetworks = false |
| 63 | +} |
| 64 | + |
| 65 | +data "google_project" "project" { |
| 66 | +} |
0 commit comments