Skip to content

Commit

Permalink
Adding deployment type to beta provider. (#12560)
Browse files Browse the repository at this point in the history
  • Loading branch information
unnatinadupalli authored Dec 17, 2024
1 parent 3141d28 commit 8fa7b5c
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 4 deletions.
16 changes: 16 additions & 0 deletions 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 @@ -184,3 +191,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}}" {
provider = google-beta
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"
}
depends_on = [google_service_networking_connection.default]
}

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

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

# Create a private connection
resource "google_service_networking_connection" "default" {
provider = google-beta
network = google_compute_network.network.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,27 @@ func TestAccParallelstoreInstance_parallelstoreInstanceBasicExample_update(t *te

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
{{ if ne $.TargetVersionName `ga` -}}
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
{{ else }}
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckParallelstoreInstanceDestroyProducer(t),
{{ end }}

CheckDestroy: testAccCheckParallelstoreInstanceDestroyProducer(t),
Steps: []resource.TestStep{

{{ if ne $.TargetVersionName `ga` -}}
{
Config: testAccParallelstoreInstance_parallelstoreInstanceBasicExampleBeta_basic(context),
},
{
ResourceName: "google_parallelstore_instance.instance",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"location", "instance_id", "labels", "terraform_labels"},
},
{{ else }}
{
Config: testAccParallelstoreInstance_parallelstoreInstanceBasicExample_basic(context),
},
{
Expand All @@ -55,7 +72,7 @@ func TestAccParallelstoreInstance_parallelstoreInstanceBasicExample_update(t *te
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"location", "instance_id", "labels", "terraform_labels"},
},

{{ end }}
},
})
}
Expand Down Expand Up @@ -111,7 +128,6 @@ resource "google_parallelstore_instance" "instance" {
description = "test instance updated"
capacity_gib = 12000
network = google_compute_network.network.name

labels = {
test = "value23"
}
Expand Down Expand Up @@ -142,4 +158,54 @@ resource "google_service_networking_connection" "default" {
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}
`, context)
}
}

{{ if ne $.TargetVersionName `ga` -}}
func testAccParallelstoreInstance_parallelstoreInstanceBasicExampleBeta_basic(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_parallelstore_instance" "instance" {
provider = google-beta
instance_id = "instance%{random_suffix}"
location = "us-central1-a"
description = "test instance"
capacity_gib = 12000
deployment_type = "SCRATCH"
network = google_compute_network.network.name
reserved_ip_range = google_compute_global_address.private_ip_alloc.name
file_stripe_level = "FILE_STRIPE_LEVEL_MIN"
directory_stripe_level = "DIRECTORY_STRIPE_LEVEL_MIN"
labels = {
test = "value"
}
depends_on = [google_service_networking_connection.default]
}

resource "google_compute_network" "network" {
provider = google-beta
name = "network%{random_suffix}"
auto_create_subnetworks = true
mtu = 8896
}



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

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

0 comments on commit 8fa7b5c

Please sign in to comment.