From 7afaf21e4fe83389aeddbcf3a91c48ffe39e3adb Mon Sep 17 00:00:00 2001 From: The Magician Date: Thu, 26 Dec 2024 09:02:25 -0800 Subject: [PATCH] Adding deployment_type to GA (#12634) (#20785) [upstream:a8d9f29193635e7a78bece5533f471ea6fa35c05] Signed-off-by: Modular Magician --- .changelog/12634.txt | 3 ++ .../resource_parallelstore_instance.go | 36 +++++++++++++++++++ ...e_parallelstore_instance_generated_test.go | 1 + .../resource_parallelstore_instance_test.go | 1 + .../r/parallelstore_instance.html.markdown | 3 +- 5 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .changelog/12634.txt diff --git a/.changelog/12634.txt b/.changelog/12634.txt new file mode 100644 index 00000000000..573e29d3928 --- /dev/null +++ b/.changelog/12634.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +parallelstore: added `deployment_type` to `google_parallelstore_instance` (GA promotion) +``` \ No newline at end of file diff --git a/google/services/parallelstore/resource_parallelstore_instance.go b/google/services/parallelstore/resource_parallelstore_instance.go index c0c4c223ed3..efbdb208317 100644 --- a/google/services/parallelstore/resource_parallelstore_instance.go +++ b/google/services/parallelstore/resource_parallelstore_instance.go @@ -78,6 +78,15 @@ func ResourceParallelstoreInstance() *schema.Resource { ForceNew: true, Description: `Part of 'parent'. See documentation of 'projectsId'.`, }, + "deployment_type": { + Type: schema.TypeString, + Optional: true, + Description: `Parallelstore Instance deployment type. + Possible values: + DEPLOYMENT_TYPE_UNSPECIFIED + SCRATCH + PERSISTENT`, + }, "description": { Type: schema.TypeString, Optional: true, @@ -271,6 +280,12 @@ func resourceParallelstoreInstanceCreate(d *schema.ResourceData, meta interface{ } else if v, ok := d.GetOkExists("directory_stripe_level"); !tpgresource.IsEmptyValue(reflect.ValueOf(directoryStripeLevelProp)) && (ok || !reflect.DeepEqual(v, directoryStripeLevelProp)) { obj["directoryStripeLevel"] = directoryStripeLevelProp } + deploymentTypeProp, err := expandParallelstoreInstanceDeploymentType(d.Get("deployment_type"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("deployment_type"); !tpgresource.IsEmptyValue(reflect.ValueOf(deploymentTypeProp)) && (ok || !reflect.DeepEqual(v, deploymentTypeProp)) { + obj["deploymentType"] = deploymentTypeProp + } labelsProp, err := expandParallelstoreInstanceEffectiveLabels(d.Get("effective_labels"), d, config) if err != nil { return err @@ -432,6 +447,9 @@ func resourceParallelstoreInstanceRead(d *schema.ResourceData, meta interface{}) if err := d.Set("directory_stripe_level", flattenParallelstoreInstanceDirectoryStripeLevel(res["directoryStripeLevel"], d, config)); err != nil { return fmt.Errorf("Error reading Instance: %s", err) } + if err := d.Set("deployment_type", flattenParallelstoreInstanceDeploymentType(res["deploymentType"], d, config)); err != nil { + return fmt.Errorf("Error reading Instance: %s", err) + } if err := d.Set("terraform_labels", flattenParallelstoreInstanceTerraformLabels(res["labels"], d, config)); err != nil { return fmt.Errorf("Error reading Instance: %s", err) } @@ -476,6 +494,12 @@ func resourceParallelstoreInstanceUpdate(d *schema.ResourceData, meta interface{ } else if v, ok := d.GetOkExists("directory_stripe_level"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, directoryStripeLevelProp)) { obj["directoryStripeLevel"] = directoryStripeLevelProp } + deploymentTypeProp, err := expandParallelstoreInstanceDeploymentType(d.Get("deployment_type"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("deployment_type"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, deploymentTypeProp)) { + obj["deploymentType"] = deploymentTypeProp + } labelsProp, err := expandParallelstoreInstanceEffectiveLabels(d.Get("effective_labels"), d, config) if err != nil { return err @@ -504,6 +528,10 @@ func resourceParallelstoreInstanceUpdate(d *schema.ResourceData, meta interface{ updateMask = append(updateMask, "directoryStripeLevel") } + if d.HasChange("deployment_type") { + updateMask = append(updateMask, "deploymentType") + } + if d.HasChange("effective_labels") { updateMask = append(updateMask, "labels") } @@ -693,6 +721,10 @@ func flattenParallelstoreInstanceDirectoryStripeLevel(v interface{}, d *schema.R return v } +func flattenParallelstoreInstanceDeploymentType(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + func flattenParallelstoreInstanceTerraformLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { if v == nil { return v @@ -736,6 +768,10 @@ func expandParallelstoreInstanceDirectoryStripeLevel(v interface{}, d tpgresourc return v, nil } +func expandParallelstoreInstanceDeploymentType(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + func expandParallelstoreInstanceEffectiveLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) { if v == nil { return map[string]string{}, nil diff --git a/google/services/parallelstore/resource_parallelstore_instance_generated_test.go b/google/services/parallelstore/resource_parallelstore_instance_generated_test.go index 773e6e31b70..a8e3696b167 100644 --- a/google/services/parallelstore/resource_parallelstore_instance_generated_test.go +++ b/google/services/parallelstore/resource_parallelstore_instance_generated_test.go @@ -65,6 +65,7 @@ resource "google_parallelstore_instance" "instance" { 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" } diff --git a/google/services/parallelstore/resource_parallelstore_instance_test.go b/google/services/parallelstore/resource_parallelstore_instance_test.go index cc435fade69..6bd981ddb47 100644 --- a/google/services/parallelstore/resource_parallelstore_instance_test.go +++ b/google/services/parallelstore/resource_parallelstore_instance_test.go @@ -72,6 +72,7 @@ resource "google_parallelstore_instance" "instance" { capacity_gib = 12000 network = google_compute_network.network.name reserved_ip_range = google_compute_global_address.private_ip_alloc.name + deployment_type = "SCRATCH" file_stripe_level = "FILE_STRIPE_LEVEL_MIN" directory_stripe_level = "DIRECTORY_STRIPE_LEVEL_MIN" labels = { diff --git a/website/docs/r/parallelstore_instance.html.markdown b/website/docs/r/parallelstore_instance.html.markdown index 4254094e63b..058e6da8fc1 100644 --- a/website/docs/r/parallelstore_instance.html.markdown +++ b/website/docs/r/parallelstore_instance.html.markdown @@ -90,6 +90,7 @@ resource "google_parallelstore_instance" "instance" { 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" } @@ -208,7 +209,7 @@ The following arguments are supported: DIRECTORY_STRIPE_LEVEL_MAX * `deployment_type` - - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) + (Optional) Parallelstore Instance deployment type. Possible values: DEPLOYMENT_TYPE_UNSPECIFIED