diff --git a/.changelog/10340.txt b/.changelog/10340.txt new file mode 100644 index 00000000000..045835d9810 --- /dev/null +++ b/.changelog/10340.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +vmwareengine: added support for stretch private clouds +``` \ No newline at end of file diff --git a/google/services/vmwareengine/resource_vmwareengine_private_cloud.go b/google/services/vmwareengine/resource_vmwareengine_private_cloud.go index afe01e88e71..0723b72eafe 100644 --- a/google/services/vmwareengine/resource_vmwareengine_private_cloud.go +++ b/google/services/vmwareengine/resource_vmwareengine_private_cloud.go @@ -170,13 +170,23 @@ the form: projects/{project_number}/locations/{location}/vmwareEngineNetworks/{v Optional: true, Description: `User-provided description for this private cloud.`, }, + "preferred_zone": { + Type: schema.TypeString, + Optional: true, + Description: `The preferred single failure domain within a region.`, + }, + "secondary_zone": { + Type: schema.TypeString, + Optional: true, + Description: `The secondary single failure domain within a region.`, + }, "type": { Type: schema.TypeString, Optional: true, ForceNew: true, - ValidateFunc: verify.ValidateEnum([]string{"STANDARD", "TIME_LIMITED", ""}), + ValidateFunc: verify.ValidateEnum([]string{"STANDARD", "TIME_LIMITED", "STRETCHED", ""}), DiffSuppressFunc: vmwareenginePrivateCloudStandardTypeDiffSuppressFunc, - Description: `Initial type of the private cloud. Possible values: ["STANDARD", "TIME_LIMITED"]`, + Description: `Initial type of the private cloud. Possible values: ["STANDARD", "TIME_LIMITED", "STRETCHED"]`, }, "hcx": { Type: schema.TypeList, @@ -321,6 +331,18 @@ func resourceVmwareenginePrivateCloudCreate(d *schema.ResourceData, meta interfa } else if v, ok := d.GetOkExists("type"); !tpgresource.IsEmptyValue(reflect.ValueOf(typeProp)) && (ok || !reflect.DeepEqual(v, typeProp)) { obj["type"] = typeProp } + preferredZoneProp, err := expandVmwareenginePrivateCloudPreferredZone(d.Get("preferred_zone"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("preferred_zone"); !tpgresource.IsEmptyValue(reflect.ValueOf(preferredZoneProp)) && (ok || !reflect.DeepEqual(v, preferredZoneProp)) { + obj["preferredZone"] = preferredZoneProp + } + secondaryZoneProp, err := expandVmwareenginePrivateCloudSecondaryZone(d.Get("secondary_zone"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("secondary_zone"); !tpgresource.IsEmptyValue(reflect.ValueOf(secondaryZoneProp)) && (ok || !reflect.DeepEqual(v, secondaryZoneProp)) { + obj["secondaryZone"] = secondaryZoneProp + } url, err := tpgresource.ReplaceVars(d, config, "{{VmwareengineBasePath}}projects/{{project}}/locations/{{location}}/privateClouds?privateCloudId={{name}}") if err != nil { @@ -454,6 +476,12 @@ func resourceVmwareenginePrivateCloudRead(d *schema.ResourceData, meta interface if err := d.Set("vcenter", flattenVmwareenginePrivateCloudVcenter(res["vcenter"], d, config)); err != nil { return fmt.Errorf("Error reading PrivateCloud: %s", err) } + if err := d.Set("preferred_zone", flattenVmwareenginePrivateCloudPreferredZone(res["preferredZone"], d, config)); err != nil { + return fmt.Errorf("Error reading PrivateCloud: %s", err) + } + if err := d.Set("secondary_zone", flattenVmwareenginePrivateCloudSecondaryZone(res["secondaryZone"], d, config)); err != nil { + return fmt.Errorf("Error reading PrivateCloud: %s", err) + } return nil } @@ -486,6 +514,18 @@ func resourceVmwareenginePrivateCloudUpdate(d *schema.ResourceData, meta interfa } else if v, ok := d.GetOkExists("management_cluster"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, managementClusterProp)) { obj["managementCluster"] = managementClusterProp } + preferredZoneProp, err := expandVmwareenginePrivateCloudPreferredZone(d.Get("preferred_zone"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("preferred_zone"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, preferredZoneProp)) { + obj["preferredZone"] = preferredZoneProp + } + secondaryZoneProp, err := expandVmwareenginePrivateCloudSecondaryZone(d.Get("secondary_zone"), d, config) + if err != nil { + return err + } else if v, ok := d.GetOkExists("secondary_zone"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, secondaryZoneProp)) { + obj["secondaryZone"] = secondaryZoneProp + } obj, err = resourceVmwareenginePrivateCloudUpdateEncoder(d, meta, obj) if err != nil { @@ -939,6 +979,14 @@ func flattenVmwareenginePrivateCloudVcenterFqdn(v interface{}, d *schema.Resourc return v } +func flattenVmwareenginePrivateCloudPreferredZone(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + +func flattenVmwareenginePrivateCloudSecondaryZone(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return v +} + func expandVmwareenginePrivateCloudDescription(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { return v, nil } @@ -1084,6 +1132,14 @@ func expandVmwareenginePrivateCloudType(v interface{}, d tpgresource.TerraformRe return v, nil } +func expandVmwareenginePrivateCloudPreferredZone(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + +func expandVmwareenginePrivateCloudSecondaryZone(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + func resourceVmwareenginePrivateCloudUpdateEncoder(d *schema.ResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) { delete(obj, "managementCluster") return obj, nil diff --git a/website/docs/r/vmwareengine_private_cloud.html.markdown b/website/docs/r/vmwareengine_private_cloud.html.markdown index b8265deb63b..c7db809f1f9 100644 --- a/website/docs/r/vmwareengine_private_cloud.html.markdown +++ b/website/docs/r/vmwareengine_private_cloud.html.markdown @@ -184,7 +184,15 @@ The following arguments are supported: * `type` - (Optional) Initial type of the private cloud. - Possible values are: `STANDARD`, `TIME_LIMITED`. + Possible values are: `STANDARD`, `TIME_LIMITED`, `STRETCHED`. + +* `preferred_zone` - + (Optional) + The preferred single failure domain within a region. + +* `secondary_zone` - + (Optional) + The secondary single failure domain within a region. * `project` - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.