Skip to content

Commit 8fa7b5c

Browse files
Adding deployment type to beta provider. (#12560)
1 parent 3141d28 commit 8fa7b5c

File tree

3 files changed

+126
-4
lines changed

3 files changed

+126
-4
lines changed

mmv1/products/parallelstore/Instance.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ async:
3737
resource_inside_response: true
3838
custom_code:
3939
examples:
40+
- name: 'parallelstore_instance_basic_beta'
41+
primary_resource_id: 'instance'
42+
min_version: 'beta'
43+
vars:
44+
name: 'instance'
45+
network_name: 'network'
46+
address_name: 'address'
4047
- name: 'parallelstore_instance_basic'
4148
primary_resource_id: 'instance'
4249
vars:
@@ -184,3 +191,12 @@ properties:
184191
DIRECTORY_STRIPE_LEVEL_MIN
185192
DIRECTORY_STRIPE_LEVEL_BALANCED
186193
DIRECTORY_STRIPE_LEVEL_MAX
194+
- name: deploymentType
195+
type: String
196+
min_version: 'beta'
197+
description: |
198+
Parallelstore Instance deployment type.
199+
Possible values:
200+
DEPLOYMENT_TYPE_UNSPECIFIED
201+
SCRATCH
202+
PERSISTENT
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
resource "google_parallelstore_instance" "{{$.PrimaryResourceId}}" {
2+
provider = google-beta
3+
instance_id = "{{index $.Vars "name"}}"
4+
location = "us-central1-a"
5+
description = "test instance"
6+
capacity_gib = 12000
7+
network = google_compute_network.network.name
8+
file_stripe_level = "FILE_STRIPE_LEVEL_MIN"
9+
directory_stripe_level = "DIRECTORY_STRIPE_LEVEL_MIN"
10+
deployment_type = "SCRATCH"
11+
labels = {
12+
test = "value"
13+
}
14+
depends_on = [google_service_networking_connection.default]
15+
}
16+
17+
resource "google_compute_network" "network" {
18+
provider = google-beta
19+
name = "{{index $.Vars "network_name"}}"
20+
auto_create_subnetworks = true
21+
mtu = 8896
22+
}
23+
24+
# Create an IP address
25+
resource "google_compute_global_address" "private_ip_alloc" {
26+
provider = google-beta
27+
name = "{{index $.Vars "address_name"}}"
28+
purpose = "VPC_PEERING"
29+
address_type = "INTERNAL"
30+
prefix_length = 24
31+
network = google_compute_network.network.id
32+
}
33+
34+
# Create a private connection
35+
resource "google_service_networking_connection" "default" {
36+
provider = google-beta
37+
network = google_compute_network.network.id
38+
service = "servicenetworking.googleapis.com"
39+
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
40+
}

mmv1/third_party/terraform/services/parallelstore/resource_parallelstore_instance_test.go.tmpl

+70-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,27 @@ func TestAccParallelstoreInstance_parallelstoreInstanceBasicExample_update(t *te
3434

3535
acctest.VcrTest(t, resource.TestCase{
3636
PreCheck: func() { acctest.AccTestPreCheck(t) },
37+
{{ if ne $.TargetVersionName `ga` -}}
38+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
39+
{{ else }}
3740
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
38-
CheckDestroy: testAccCheckParallelstoreInstanceDestroyProducer(t),
41+
{{ end }}
42+
43+
CheckDestroy: testAccCheckParallelstoreInstanceDestroyProducer(t),
3944
Steps: []resource.TestStep{
45+
46+
{{ if ne $.TargetVersionName `ga` -}}
47+
{
48+
Config: testAccParallelstoreInstance_parallelstoreInstanceBasicExampleBeta_basic(context),
49+
},
4050
{
51+
ResourceName: "google_parallelstore_instance.instance",
52+
ImportState: true,
53+
ImportStateVerify: true,
54+
ImportStateVerifyIgnore: []string{"location", "instance_id", "labels", "terraform_labels"},
55+
},
56+
{{ else }}
57+
{
4158
Config: testAccParallelstoreInstance_parallelstoreInstanceBasicExample_basic(context),
4259
},
4360
{
@@ -55,7 +72,7 @@ func TestAccParallelstoreInstance_parallelstoreInstanceBasicExample_update(t *te
5572
ImportStateVerify: true,
5673
ImportStateVerifyIgnore: []string{"location", "instance_id", "labels", "terraform_labels"},
5774
},
58-
75+
{{ end }}
5976
},
6077
})
6178
}
@@ -111,7 +128,6 @@ resource "google_parallelstore_instance" "instance" {
111128
description = "test instance updated"
112129
capacity_gib = 12000
113130
network = google_compute_network.network.name
114-
115131
labels = {
116132
test = "value23"
117133
}
@@ -142,4 +158,54 @@ resource "google_service_networking_connection" "default" {
142158
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
143159
}
144160
`, context)
145-
}
161+
}
162+
163+
{{ if ne $.TargetVersionName `ga` -}}
164+
func testAccParallelstoreInstance_parallelstoreInstanceBasicExampleBeta_basic(context map[string]interface{}) string {
165+
return acctest.Nprintf(`
166+
resource "google_parallelstore_instance" "instance" {
167+
provider = google-beta
168+
instance_id = "instance%{random_suffix}"
169+
location = "us-central1-a"
170+
description = "test instance"
171+
capacity_gib = 12000
172+
deployment_type = "SCRATCH"
173+
network = google_compute_network.network.name
174+
reserved_ip_range = google_compute_global_address.private_ip_alloc.name
175+
file_stripe_level = "FILE_STRIPE_LEVEL_MIN"
176+
directory_stripe_level = "DIRECTORY_STRIPE_LEVEL_MIN"
177+
labels = {
178+
test = "value"
179+
}
180+
depends_on = [google_service_networking_connection.default]
181+
}
182+
183+
resource "google_compute_network" "network" {
184+
provider = google-beta
185+
name = "network%{random_suffix}"
186+
auto_create_subnetworks = true
187+
mtu = 8896
188+
}
189+
190+
191+
192+
# Create an IP address
193+
resource "google_compute_global_address" "private_ip_alloc" {
194+
provider = google-beta
195+
name = "address%{random_suffix}"
196+
purpose = "VPC_PEERING"
197+
address_type = "INTERNAL"
198+
prefix_length = 24
199+
network = google_compute_network.network.id
200+
}
201+
202+
# Create a private connection
203+
resource "google_service_networking_connection" "default" {
204+
provider = google-beta
205+
network = google_compute_network.network.id
206+
service = "servicenetworking.googleapis.com"
207+
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
208+
}
209+
`, context)
210+
}
211+
{{ end }}

0 commit comments

Comments
 (0)