Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ider-vcd into content-library-item

Signed-off-by: abarreiro <[email protected]>
  • Loading branch information
abarreiro committed Nov 21, 2024
2 parents b2a24e9 + aaee3ef commit 10e29f2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .changes/v4.0.0/1348-features.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* **New Resource:** `vcd_tm_region` to manage Regions [GH-1348]
* **New Data Source:** `vcd_tm_region` to read Regions [GH-1348]
* **New Resource:** `vcd_tm_region` to manage Regions [GH-1348, GH-1354]
* **New Data Source:** `vcd_tm_region` to read Regions [GH-1348, GH-1354]
* **New Data Source:** `vcd_tm_supervisor` to read Supervisors [GH-1348]
* **New Data Source:** `vcd_tm_supervisor_zone` to read Supervisor Zones [GH-1348]
9 changes: 4 additions & 5 deletions vcd/resource_vcd_tm_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,10 @@ func setRegionData(d *schema.ResourceData, r *govcd.Region) error {
return fmt.Errorf("error storing 'supervisors': %s", err)
}

// TODO: TM: storage policies are not returned on read
// err = d.Set("storage_policy_names", r.Region.StoragePolicies)
// if err != nil {
// return fmt.Errorf("error storing 'storage_policy_names': %s", err)
// }
err = d.Set("storage_policy_names", r.Region.StoragePolicies)
if err != nil {
return fmt.Errorf("error storing 'storage_policy_names': %s", err)
}

return nil
}
13 changes: 6 additions & 7 deletions vcd/resource_vcd_tm_region_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ func TestAccVcdTmRegion(t *testing.T) {
resource.TestCheckResourceAttrSet("vcd_tm_region.test", "memory_capacity_mib"),
resource.TestCheckResourceAttrSet("vcd_tm_region.test", "memory_reservation_capacity_mib"),
resource.TestCheckResourceAttr("vcd_tm_region.test", "status", "READY"),
resource.TestCheckResourceAttr("vcd_tm_region.test", "storage_policy_names.#", "1"),
resource.TestCheckTypeSetElemAttr("vcd_tm_region.test", "storage_policy_names.*", testConfig.Tm.VcenterStorageProfile),

resource.TestCheckResourceAttrSet("data.vcd_tm_supervisor.test", "id"),
resource.TestCheckResourceAttrPair("data.vcd_tm_supervisor.test", "vcenter_id", "vcd_vcenter.test", "id"),

resource.TestCheckResourceAttrSet("data.vcd_tm_supervisor_zone.test", "id"),
resource.TestCheckResourceAttrPair("data.vcd_tm_supervisor_zone.test", "vcenter_id", "vcd_vcenter.test", "id"),
resource.TestCheckResourceAttrSet("data.vcd_tm_supervisor_zone.test", "cpu_capacity_mhz"),
Expand All @@ -98,6 +99,8 @@ func TestAccVcdTmRegion(t *testing.T) {
resource.TestCheckResourceAttrSet("vcd_tm_region.test", "memory_capacity_mib"),
resource.TestCheckResourceAttrSet("vcd_tm_region.test", "memory_reservation_capacity_mib"),
resource.TestCheckResourceAttr("vcd_tm_region.test", "status", "READY"),
resource.TestCheckResourceAttr("vcd_tm_region.test", "storage_policy_names.#", "1"),
resource.TestCheckTypeSetElemAttr("vcd_tm_region.test", "storage_policy_names.*", testConfig.Tm.VcenterStorageProfile),

resource.TestCheckResourceAttrSet("data.vcd_tm_supervisor.test", "id"),
resource.TestCheckResourceAttrPair("data.vcd_tm_supervisor.test", "vcenter_id", "vcd_vcenter.test", "id"),
Expand All @@ -114,9 +117,7 @@ func TestAccVcdTmRegion(t *testing.T) {
Config: configText3,
Check: resource.ComposeTestCheckFunc(
resourceFieldsEqual("vcd_tm_region.test", "data.vcd_tm_region.test", []string{
"storage_policy_names.#", // TODO: TM: field is not populated on read
"storage_policy_names.0", // TODO: TM: field is not populated on read
"is_enabled", // TODO: TM: field is not populated on read
"is_enabled", // TODO: TM: field is not populated on read
}),
),
},
Expand All @@ -126,9 +127,7 @@ func TestAccVcdTmRegion(t *testing.T) {
ImportStateVerify: true,
ImportStateId: params["Testname"].(string),
ImportStateVerifyIgnore: []string{
"storage_policy_names.#", // TODO: TM: field is not populated on read
"storage_policy_names.0", // TODO: TM: field is not populated on read
"is_enabled", // TODO: TM: field is not populated on read
"is_enabled", // TODO: TM: field is not populated on read
},
},
},
Expand Down

0 comments on commit 10e29f2

Please sign in to comment.