From 4840e0281100531863952bac0185395d27b72c3f Mon Sep 17 00:00:00 2001 From: unnatinadupalli <156947936+unnatinadupalli@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:28:34 -0800 Subject: [PATCH] Parallelstore: adding deployment type to beta provider and making network field required. (#12558) --- mmv1/products/parallelstore/Instance.yaml | 19 ++++++++- .../parallelstore_instance_baic_beta.tmpl | 40 +++++++++++++++++++ ...source_parallelstore_instance_test.go.tmpl | 15 ++++++- 3 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 mmv1/templates/terraform/examples/parallelstore_instance_baic_beta.tmpl diff --git a/mmv1/products/parallelstore/Instance.yaml b/mmv1/products/parallelstore/Instance.yaml index 7fd33f0f00af..79ca222dfd5f 100644 --- a/mmv1/products/parallelstore/Instance.yaml +++ b/mmv1/products/parallelstore/Instance.yaml @@ -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: @@ -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' @@ -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 diff --git a/mmv1/templates/terraform/examples/parallelstore_instance_baic_beta.tmpl b/mmv1/templates/terraform/examples/parallelstore_instance_baic_beta.tmpl new file mode 100644 index 000000000000..c54aebc317cd --- /dev/null +++ b/mmv1/templates/terraform/examples/parallelstore_instance_baic_beta.tmpl @@ -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] +} \ No newline at end of file diff --git a/mmv1/third_party/terraform/services/parallelstore/resource_parallelstore_instance_test.go.tmpl b/mmv1/third_party/terraform/services/parallelstore/resource_parallelstore_instance_test.go.tmpl index 87fb1e74fdee..a31351169094 100644 --- a/mmv1/third_party/terraform/services/parallelstore/resource_parallelstore_instance_test.go.tmpl +++ b/mmv1/third_party/terraform/services/parallelstore/resource_parallelstore_instance_test.go.tmpl @@ -18,6 +18,7 @@ package parallelstore_test +{{ if ne $.TargetVersionName `ga` -}} import ( "testing" @@ -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{ { @@ -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" @@ -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 } @@ -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 } @@ -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) @@ -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" } @@ -122,6 +127,7 @@ resource "google_compute_network" "network" { name = "network%{random_suffix}" auto_create_subnetworks = true mtu = 8896 + provider = google-beta } @@ -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 }} } \ No newline at end of file