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