Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type field to PrivateCloud in Vmwareengine #16781

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/9608.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
vmwareengine: added `type` field to `google_vmwareengine_private_cloud` resource
```
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ the form: projects/{project_number}/locations/{location}/vmwareEngineNetworks/{v
Optional: true,
Description: `User-provided description for this private cloud.`,
},
"type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: verify.ValidateEnum([]string{"STANDARD", "TIME_LIMITED", ""}),
Description: `Initial type of the private cloud. Default value: "STANDARD" Possible values: ["STANDARD", "TIME_LIMITED"]`,
Default: "STANDARD",
},
"hcx": {
Type: schema.TypeList,
Computed: true,
Expand Down Expand Up @@ -300,6 +308,12 @@ func resourceVmwareenginePrivateCloudCreate(d *schema.ResourceData, meta interfa
} else if v, ok := d.GetOkExists("management_cluster"); !tpgresource.IsEmptyValue(reflect.ValueOf(managementClusterProp)) && (ok || !reflect.DeepEqual(v, managementClusterProp)) {
obj["managementCluster"] = managementClusterProp
}
typeProp, err := expandVmwareenginePrivateCloudType(d.Get("type"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("type"); !tpgresource.IsEmptyValue(reflect.ValueOf(typeProp)) && (ok || !reflect.DeepEqual(v, typeProp)) {
obj["type"] = typeProp
}

url, err := tpgresource.ReplaceVars(d, config, "{{VmwareengineBasePath}}projects/{{project}}/locations/{{location}}/privateClouds?privateCloudId={{name}}")
if err != nil {
Expand Down Expand Up @@ -1059,6 +1073,10 @@ func expandVmwareenginePrivateCloudManagementClusterNodeTypeConfigsCustomCoreCou
return v, nil
}

func expandVmwareenginePrivateCloudType(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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestAccVmwareenginePrivateCloud_vmwareEnginePrivateCloudUpdate(t *testing.T
CheckDestroy: testAccCheckVmwareenginePrivateCloudDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testPrivateCloudUpdateConfig(context, "description1", 3),
Config: testPrivateCloudUpdateConfig(context, "description1", 1),
Check: resource.ComposeTestCheckFunc(
acctest.CheckDataSourceStateMatchesResourceStateWithIgnores("data.google_vmwareengine_private_cloud.ds", "google_vmwareengine_private_cloud.vmw-engine-pc", map[string]struct{}{}),
testAccCheckGoogleVmwareengineNsxCredentialsMeta("data.google_vmwareengine_nsx_credentials.nsx-ds"),
Expand Down Expand Up @@ -80,6 +80,7 @@ resource "google_vmwareengine_private_cloud" "vmw-engine-pc" {
location = "%{region}-a"
name = "tf-test-sample-pc%{random_suffix}"
description = "%{description}"
type = "TIME_LIMITED"
network_config {
management_cidr = "192.168.30.0/24"
vmware_engine_network = google_vmwareengine_network.default-nw.id
Expand All @@ -106,6 +107,7 @@ data "google_vmwareengine_private_cloud" "ds" {
data "google_vmwareengine_nsx_credentials" "nsx-ds" {
parent = google_vmwareengine_private_cloud.vmw-engine-pc.id
}

data "google_vmwareengine_vcenter_credentials" "vcenter-ds" {
parent = google_vmwareengine_private_cloud.vmw-engine-pc.id
}
Expand Down
14 changes: 11 additions & 3 deletions website/docs/r/vmwareengine_private_cloud.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
# ----------------------------------------------------------------------------
subcategory: "Cloud VMware Engine"
description: |-
/ Represents a private cloud resource.
Represents a private cloud resource.
---

# google\_vmwareengine\_private\_cloud

/ Represents a private cloud resource. Private clouds are zonal resources.
Represents a private cloud resource. Private clouds are zonal resources.


To get more information about PrivateCloud, see:
Expand Down Expand Up @@ -63,6 +63,7 @@ resource "google_vmwareengine_private_cloud" "vmw-engine-pc" {
location = "us-west1-a"
name = "sample-pc"
description = "Sample test PC."
type = "TIME_LIMITED"
network_config {
management_cidr = "192.168.30.0/24"
vmware_engine_network = google_vmwareengine_network.pc-nw.id
Expand All @@ -72,7 +73,7 @@ resource "google_vmwareengine_private_cloud" "vmw-engine-pc" {
cluster_id = "sample-mgmt-cluster"
node_type_configs {
node_type_id = "standard-72"
node_count = 3
node_count = 1
custom_core_count = 32
}
}
Expand All @@ -83,6 +84,7 @@ resource "google_vmwareengine_network" "pc-nw" {
location = "global"
type = "STANDARD"
description = "PC network description."
}
```

## Argument Reference
Expand Down Expand Up @@ -179,6 +181,12 @@ The following arguments are supported:
(Optional)
User-provided description for this private cloud.

* `type` -
(Optional)
Initial type of the private cloud.
Default value is `STANDARD`.
Possible values are: `STANDARD`, `TIME_LIMITED`.

* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.

Expand Down