From 259a6976ca9a2b2936a8b4535801fb6d5f78aef8 Mon Sep 17 00:00:00 2001 From: Anuradha Bose Date: Wed, 17 Jan 2024 18:52:58 +0000 Subject: [PATCH 1/5] add storage pool ids to volume collection --- .../hpegl_metal_available_resources/README.md | 6 +++++ go.mod | 2 +- go.sum | 4 +-- .../datasource_available_resources.go | 26 +++++++++++++------ 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/examples/data-sources/hpegl_metal_available_resources/README.md b/examples/data-sources/hpegl_metal_available_resources/README.md index a3c05f7..7b4ac55 100644 --- a/examples/data-sources/hpegl_metal_available_resources/README.md +++ b/examples/data-sources/hpegl_metal_available_resources/README.md @@ -139,12 +139,18 @@ storage-pools = [ "Name": "abtest", "LocationID": "c8b3c5a7-f81d-453a-af3a-1e6d78291bd5", "Description": "" + "StoragePoolIDs": [ + "bdbbb385-2ee3-4e71-a60a-ba712cdda37e" + ] }, { "ID": "dd253c2a-defb-41c7-b23d-f9a937c37da0", "Name": "abose-tf-test", "LocationID": "c8b3c5a7-f81d-453a-af3a-1e6d78291bd5", "Description": "" + "StoragePoolIDs": [ + "bdbbb385-2ee3-4e71-a60a-ba712cdda37e" + ] } ] ``` diff --git a/go.mod b/go.mod index d3e8fae..166dc91 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/golangci/golangci-lint v1.55.2 github.com/hashicorp/terraform-plugin-docs v0.16.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.31.0 - github.com/hewlettpackard/hpegl-metal-client v1.5.5 + github.com/hewlettpackard/hpegl-metal-client v1.5.6 github.com/hewlettpackard/hpegl-provider-lib v0.0.14 github.com/stretchr/testify v1.8.4 gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index dae9f62..af80589 100644 --- a/go.sum +++ b/go.sum @@ -400,8 +400,8 @@ github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S github.com/hashicorp/terraform-svchost v0.1.1/go.mod h1:mNsjQfZyf/Jhz35v6/0LWcv26+X7JPS+buii2c9/ctc= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= -github.com/hewlettpackard/hpegl-metal-client v1.5.5 h1:b7MkBzjX3Vydfdc+HmbpqcPLdjnpOmJLyUgF8eBnHU4= -github.com/hewlettpackard/hpegl-metal-client v1.5.5/go.mod h1:z8JEXcrqvD22jOofmU/3ZZOHBXk2yljfahDmquMRxas= +github.com/hewlettpackard/hpegl-metal-client v1.5.6 h1:hCr4AGbto86nbZqLxMbLvAmeEU7LDN7WnVTmcIZcjNM= +github.com/hewlettpackard/hpegl-metal-client v1.5.6/go.mod h1:5E6K3bq3aoBNuolGpbmeD/JuAarnXS96W/MqiHUTmFQ= github.com/hewlettpackard/hpegl-provider-lib v0.0.14 h1:fwIXQsdEdeYYvaJQr1vwfPgCGYKgZaP7kL0p8xbBQJ4= github.com/hewlettpackard/hpegl-provider-lib v0.0.14/go.mod h1:7StTTobQIl8pZCLcJnZm0/+N4lNE2MO6H/U0LhTfXog= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= diff --git a/internal/resources/datasource_available_resources.go b/internal/resources/datasource_available_resources.go index 70a4651..a06f292 100644 --- a/internal/resources/datasource_available_resources.go +++ b/internal/resources/datasource_available_resources.go @@ -64,10 +64,11 @@ const ( spCapacity = "capacity" // For avVolumeCollections each terraform block has these attributes. - vcName = "name" - vcLocation = "location" - vcLocationID = "location_id" - vcDescription = "description" + vcName = "name" + vcLocation = "location" + vcLocationID = "location_id" + vcDescription = "description" + vcStoragePoolIDs = "storage_pool_ids" ) func locationResources() *schema.Resource { @@ -216,6 +217,14 @@ func volumeCollectionResource() *schema.Resource { Computed: true, Description: "Description of the volume collection", }, + vcStoragePoolIDs: { + Type: schema.TypeList, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Description: "A list of valid storage pool ids.", + }, }, } } @@ -552,10 +561,11 @@ func addVolumeCollections(p *configuration.Config, d *schema.ResourceData, avail for _, vcol := range available.VolumeCollections { iData := map[string]interface{}{ - "id": vcol.ID, - vcName: vcol.Name, - vcLocationID: vcol.LocationID, - vcDescription: vcol.Description, + "id": vcol.ID, + vcName: vcol.Name, + vcLocationID: vcol.LocationID, + vcDescription: vcol.Description, + vcStoragePoolIDs: vcol.StoragePoolIDs, } iData[vLocation], _ = p.GetLocationName(vcol.LocationID) From 81424c7bb5bcbf413b2b3fccbc2b79e02d75e101 Mon Sep 17 00:00:00 2001 From: Anuradha Bose Date: Thu, 18 Jan 2024 16:24:11 +0000 Subject: [PATCH 2/5] mike comments --- examples/data-sources/hpegl_metal_available_resources/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/data-sources/hpegl_metal_available_resources/README.md b/examples/data-sources/hpegl_metal_available_resources/README.md index 7b4ac55..07ca76d 100644 --- a/examples/data-sources/hpegl_metal_available_resources/README.md +++ b/examples/data-sources/hpegl_metal_available_resources/README.md @@ -149,7 +149,7 @@ storage-pools = [ "LocationID": "c8b3c5a7-f81d-453a-af3a-1e6d78291bd5", "Description": "" "StoragePoolIDs": [ - "bdbbb385-2ee3-4e71-a60a-ba712cdda37e" + "bdbbb385-2ee3-4e71-a60a-ba712cdda37e" ] } ] From 8caccb6ab76404a0c453484bf31dce3c0de8b2f2 Mon Sep 17 00:00:00 2001 From: Anuradha Bose Date: Thu, 18 Jan 2024 16:31:03 +0000 Subject: [PATCH 3/5] ron comments --- internal/resources/datasource_available_resources.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/resources/datasource_available_resources.go b/internal/resources/datasource_available_resources.go index a06f292..e4ef730 100644 --- a/internal/resources/datasource_available_resources.go +++ b/internal/resources/datasource_available_resources.go @@ -223,7 +223,7 @@ func volumeCollectionResource() *schema.Resource { Elem: &schema.Schema{ Type: schema.TypeString, }, - Description: "A list of valid storage pool ids.", + Description: "A list of storage pool ids", }, }, } From c8801428bca9a2d0a671f8b70e98d664f51efcaf Mon Sep 17 00:00:00 2001 From: Anuradha Bose Date: Thu, 18 Jan 2024 22:32:51 +0000 Subject: [PATCH 4/5] mike comments: identation --- .../hpegl_metal_available_resources/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/data-sources/hpegl_metal_available_resources/README.md b/examples/data-sources/hpegl_metal_available_resources/README.md index 07ca76d..da7b7c8 100644 --- a/examples/data-sources/hpegl_metal_available_resources/README.md +++ b/examples/data-sources/hpegl_metal_available_resources/README.md @@ -140,16 +140,16 @@ storage-pools = [ "LocationID": "c8b3c5a7-f81d-453a-af3a-1e6d78291bd5", "Description": "" "StoragePoolIDs": [ - "bdbbb385-2ee3-4e71-a60a-ba712cdda37e" - ] + "bdbbb385-2ee3-4e71-a60a-ba712cdda37e" + ] }, { "ID": "dd253c2a-defb-41c7-b23d-f9a937c37da0", "Name": "abose-tf-test", "LocationID": "c8b3c5a7-f81d-453a-af3a-1e6d78291bd5", "Description": "" - "StoragePoolIDs": [ - "bdbbb385-2ee3-4e71-a60a-ba712cdda37e" + "StoragePoolIDs": [ + "bdbbb385-2ee3-4e71-a60a-ba712cdda37e" ] } ] From 09bf6deffbb8b500c3da037cc52aa351bab73369 Mon Sep 17 00:00:00 2001 From: Anuradha Bose Date: Fri, 19 Jan 2024 14:30:05 +0000 Subject: [PATCH 5/5] indentation --- examples/data-sources/hpegl_metal_available_resources/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/data-sources/hpegl_metal_available_resources/README.md b/examples/data-sources/hpegl_metal_available_resources/README.md index da7b7c8..d4f1cb2 100644 --- a/examples/data-sources/hpegl_metal_available_resources/README.md +++ b/examples/data-sources/hpegl_metal_available_resources/README.md @@ -150,7 +150,7 @@ storage-pools = [ "Description": "" "StoragePoolIDs": [ "bdbbb385-2ee3-4e71-a60a-ba712cdda37e" - ] + ] } ] ```