Skip to content

Commit

Permalink
Parallelstore: adding deployment type to beta provider and making net…
Browse files Browse the repository at this point in the history
…work field required. (#12558)
  • Loading branch information
unnatinadupalli authored Dec 12, 2024
1 parent 2905156 commit 4840e02
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 3 deletions.
19 changes: 18 additions & 1 deletion mmv1/products/parallelstore/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ async:
resource_inside_response: true
custom_code:
examples:
- name: 'parallelstore_instance_basic_beta'
primary_resource_id: 'instance'
min_version: 'beta'
vars:
name: 'instance'
network_name: 'network'
address_name: 'address'
- name: 'parallelstore_instance_basic'
primary_resource_id: 'instance'
vars:
Expand Down Expand Up @@ -141,8 +148,9 @@ properties:
type: String
- name: 'network'
type: String
required: true
description: |
Immutable. The name of the Google Compute Engine [VPC network](https://cloud.google.com/vpc/docs/vpc)
Required. Immutable. The name of the Google Compute Engine [VPC network](https://cloud.google.com/vpc/docs/vpc)
to which the instance is connected.
immutable: true
- name: 'reservedIpRange'
Expand Down Expand Up @@ -184,3 +192,12 @@ properties:
DIRECTORY_STRIPE_LEVEL_MIN
DIRECTORY_STRIPE_LEVEL_BALANCED
DIRECTORY_STRIPE_LEVEL_MAX
- name: deploymentType
type: String
min_version: 'beta'
description: |
Parallelstore Instance deployment type.
Possible values:
DEPLOYMENT_TYPE_UNSPECIFIED
SCRATCH
PERSISTENT
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
resource "google_parallelstore_instance" "{{$.PrimaryResourceId}}" {
instance_id = "{{index $.Vars "name"}}"
location = "us-central1-a"
description = "test instance"
capacity_gib = 12000
network = google_compute_network.network.name
file_stripe_level = "FILE_STRIPE_LEVEL_MIN"
directory_stripe_level = "DIRECTORY_STRIPE_LEVEL_MIN"
deployment_type = "SCRATCH"
labels = {
test = "value"
}
provider = google-beta
depends_on = [google_service_networking_connection.default]
}

resource "google_compute_network" "network" {
name = "{{index $.Vars "network_name"}}"
auto_create_subnetworks = true
mtu = 8896
provider = google-beta
}

# Create an IP address
resource "google_compute_global_address" "private_ip_alloc" {
name = "{{index $.Vars "address_name"}}"
purpose = "VPC_PEERING"
address_type = "INTERNAL"
prefix_length = 24
provider = google-beta
network = google_compute_network.network.id
}

# Create a private connection
resource "google_service_networking_connection" "default" {
network = google_compute_network.network.id
service = "servicenetworking.googleapis.com"
provider = google-beta
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package parallelstore_test

{{ if ne $.TargetVersionName `ga` -}}
import (
"testing"

Expand All @@ -34,7 +35,7 @@ func TestAccParallelstoreInstance_parallelstoreInstanceBasicExample_update(t *te

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
CheckDestroy: testAccCheckParallelstoreInstanceDestroyProducer(t),
Steps: []resource.TestStep{
{
Expand Down Expand Up @@ -70,6 +71,7 @@ resource "google_parallelstore_instance" "instance" {
network = google_compute_network.network.name
reserved_ip_range = google_compute_global_address.private_ip_alloc.name
file_stripe_level = "FILE_STRIPE_LEVEL_MIN"
provider = google-beta
directory_stripe_level = "DIRECTORY_STRIPE_LEVEL_MIN"
labels = {
test = "value"
Expand All @@ -80,6 +82,7 @@ resource "google_parallelstore_instance" "instance" {
resource "google_compute_network" "network" {
name = "network%{random_suffix}"
auto_create_subnetworks = true
provider = google-beta
mtu = 8896
}

Expand All @@ -90,6 +93,7 @@ resource "google_compute_global_address" "private_ip_alloc" {
name = "address%{random_suffix}"
purpose = "VPC_PEERING"
address_type = "INTERNAL"
provider = google-beta
prefix_length = 24
network = google_compute_network.network.id
}
Expand All @@ -98,6 +102,7 @@ resource "google_compute_global_address" "private_ip_alloc" {
resource "google_service_networking_connection" "default" {
network = google_compute_network.network.id
service = "servicenetworking.googleapis.com"
provider = google-beta
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}
`, context)
Expand All @@ -111,7 +116,7 @@ resource "google_parallelstore_instance" "instance" {
description = "test instance updated"
capacity_gib = 12000
network = google_compute_network.network.name

provider = google-beta
labels = {
test = "value23"
}
Expand All @@ -122,6 +127,7 @@ resource "google_compute_network" "network" {
name = "network%{random_suffix}"
auto_create_subnetworks = true
mtu = 8896
provider = google-beta
}


Expand All @@ -132,14 +138,19 @@ resource "google_compute_global_address" "private_ip_alloc" {
purpose = "VPC_PEERING"
address_type = "INTERNAL"
prefix_length = 24
provider = google-beta
network = google_compute_network.network.id
}

# Create a private connection
resource "google_service_networking_connection" "default" {
network = google_compute_network.network.id
provider = google-beta
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}
`, context)
}

{{ end }}
}

0 comments on commit 4840e02

Please sign in to comment.