Skip to content

Commit 1229c67

Browse files
shubhamdamaniamanMahendroo
authored andcommitted
Enable usage of flags related to instance mode and instance endpoints. (GoogleCloudPlatform#12079)
1 parent 11e83d9 commit 1229c67

File tree

3 files changed

+189
-0
lines changed

3 files changed

+189
-0
lines changed

mmv1/products/memorystore/Instance.yaml

+117
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,89 @@ properties:
342342
description: "Optional. If set to true deletion of the instance will fail. "
343343
min_version: 'beta'
344344
default_value: true
345+
- name: 'endpoints'
346+
type: Array
347+
description: "Endpoints for the instance."
348+
min_version: 'beta'
349+
output: true
350+
item_type:
351+
type: Array
352+
description: "A group of PSC connections. They are created in the same VPC network, one for each service attachment in the cluster."
353+
item_type:
354+
type: NestedObject
355+
properties:
356+
- name: 'pscConnectionId'
357+
type: String
358+
description:
359+
"Output only. The PSC connection id of the forwarding rule connected
360+
to the\nservice attachment. "
361+
min_version: 'beta'
362+
output: true
363+
- name: 'ipAddress'
364+
type: String
365+
description:
366+
"Output only. The IP allocated on the consumer network for the
367+
PSC forwarding rule. "
368+
min_version: 'beta'
369+
output: true
370+
- name: 'forwardingRule'
371+
type: String
372+
description: "Output only. The URI of the consumer side forwarding rule.\nFormat:\nprojects/{project}/regions/{region}/forwardingRules/{forwarding_rule} "
373+
min_version: 'beta'
374+
output: true
375+
- name: 'projectId'
376+
type: String
377+
description:
378+
"Output only. The consumer project_id where the forwarding rule is
379+
created from. "
380+
min_version: 'beta'
381+
output: true
382+
- name: 'network'
383+
type: String
384+
description:
385+
"Output only. The consumer network where the IP address resides, in
386+
the form of\nprojects/{project_id}/global/networks/{network_id}. "
387+
min_version: 'beta'
388+
output: true
389+
- name: 'serviceAttachment'
390+
type: String
391+
description:
392+
"Output only. The service attachment which is the target of the PSC connection, in the form of
393+
projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}."
394+
min_version: 'beta'
395+
output: true
396+
- name: 'pscConnectionStatus'
397+
type: Enum
398+
description:
399+
"Output Only. The status of the PSC connection: whether a connection exists and ACTIVE or it no longer exists.
400+
\n Possible values:\n ACTIVE \n NOT_FOUND"
401+
min_version: 'beta'
402+
output: true
403+
enum_values:
404+
- 'ACTIVE'
405+
- 'NOT_FOUND'
406+
- name: 'connectionType'
407+
type: Enum
408+
description:
409+
"Output Only. Type of a PSC Connection.
410+
\n Possible values:\n CONNECTION_TYPE_DISCOVERY \n CONNECTION_TYPE_PRIMARY \n CONNECTION_TYPE_READER"
411+
min_version: 'beta'
412+
output: true
413+
enum_values:
414+
- 'CONNECTION_TYPE_READER'
415+
- 'CONNECTION_TYPE_PRIMARY'
416+
- 'CONNECTION_TYPE_DISCOVERY'
417+
- name: 'mode'
418+
type: Enum
419+
description:
420+
"Optional. Standalone or cluster.
421+
\n Possible values:\n CLUSTER\nSTANDALONE"
422+
min_version: 'beta'
423+
default_from_api: true
424+
immutable: true
425+
enum_values:
426+
- 'CLUSTER'
427+
- 'STANDALONE'
345428
- name: 'pscAutoConnections'
346429
type: Array
347430
description:
@@ -385,3 +468,37 @@ properties:
385468
the form of\nprojects/{project_id}/global/networks/{network_id}. "
386469
min_version: 'beta'
387470
output: true
471+
- name: 'serviceAttachment'
472+
type: String
473+
description:
474+
"Output only. The service attachment which is the target of the PSC connection, in the form of
475+
projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}."
476+
min_version: 'beta'
477+
output: true
478+
- name: 'pscConnectionStatus'
479+
type: Enum
480+
description:
481+
"Output Only. The status of the PSC connection: whether a connection exists and ACTIVE or it no longer exists.
482+
\n Possible values:\n ACTIVE \n NOT_FOUND"
483+
min_version: 'beta'
484+
output: true
485+
enum_values:
486+
- 'ACTIVE'
487+
- 'NOT_FOUND'
488+
- name: 'connectionType'
489+
type: Enum
490+
description:
491+
"Output Only. Type of a PSC Connection.
492+
\n Possible values:\n CONNECTION_TYPE_DISCOVERY \n CONNECTION_TYPE_PRIMARY \n CONNECTION_TYPE_READER"
493+
min_version: 'beta'
494+
output: true
495+
enum_values:
496+
- 'CONNECTION_TYPE_READER'
497+
- 'CONNECTION_TYPE_PRIMARY'
498+
- 'CONNECTION_TYPE_DISCOVERY'
499+
- name: 'port'
500+
type: Integer
501+
description:
502+
"Output only. Ports of the exposed endpoint."
503+
output: true
504+
min_version: 'beta'

mmv1/templates/terraform/examples/memorystore_instance_full.tf.tmpl

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ resource "google_memorystore_instance" "{{$.PrimaryResourceId}}" {
2020
}
2121
engine_version = "VALKEY_7_2"
2222
deletion_protection_enabled = false
23+
mode = "CLUSTER"
2324
persistence_config {
2425
mode = "RDB"
2526
rdb_config {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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

Comments
 (0)