From 8572282fa0acf5fc64f1528653a26e663d243d6b Mon Sep 17 00:00:00 2001 From: Malay Chitranshi Date: Tue, 29 Oct 2024 03:05:31 -0700 Subject: [PATCH 1/2] Added changes in volume object. --- go.mod | 4 ++-- go.sum | 8 ++++---- internal/resources/resource_volume.go | 18 ++++++++++++++++++ version | 2 +- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 377fb73..973dc44 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/golangci/golangci-lint v1.58.2 github.com/hashicorp/terraform-plugin-docs v0.19.4 github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 - github.com/hewlettpackard/hpegl-metal-client v1.5.23 + github.com/hewlettpackard/hpegl-metal-client v1.5.24 github.com/hewlettpackard/hpegl-provider-lib v0.0.21 github.com/stretchr/testify v1.9.0 gopkg.in/yaml.v2 v2.4.0 @@ -231,7 +231,7 @@ require ( golang.org/x/exp/typeparams v0.0.0-20240314144324-c7f7c6466f7f // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.25.0 // indirect - golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.21.0 // indirect golang.org/x/text v0.16.0 // indirect diff --git a/go.sum b/go.sum index 09726aa..017e14f 100644 --- a/go.sum +++ b/go.sum @@ -387,8 +387,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.23 h1:EQuYg4qGpUUF11hNYqb3ekzUKgqIfQd2RNg1Y3SCGqc= -github.com/hewlettpackard/hpegl-metal-client v1.5.23/go.mod h1:+BO4BfQXf3IWnsxvk2IdE27Ijrm1jDVYIgpebYh1L9M= +github.com/hewlettpackard/hpegl-metal-client v1.5.24 h1:x9UgKqw3nZ2LG45iEFqtAkXM7Ghg5R1xwEHXPDgE2FQ= +github.com/hewlettpackard/hpegl-metal-client v1.5.24/go.mod h1:DJRxRgIRZf+Wb8soq3RTKh2f3l0KhJLlfUWrY5/twcw= github.com/hewlettpackard/hpegl-provider-lib v0.0.21 h1:35cmYg/UceVtxZHDMCKcEeAGhdJ5rzWi7JRrY/hS0BY= github.com/hewlettpackard/hpegl-provider-lib v0.0.21/go.mod h1:Bw2DhefBjqXQI6s5vBBGiWUkFz7fx4KkbGfwmo9wv3U= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= @@ -849,8 +849,8 @@ golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= -golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/internal/resources/resource_volume.go b/internal/resources/resource_volume.go index 194d6d1..f6de65b 100644 --- a/internal/resources/resource_volume.go +++ b/internal/resources/resource_volume.go @@ -38,6 +38,8 @@ const ( vCreatedSite = "created_site" vReplicationEnabled = "replication_enabled" vExportCount = "export_count" + vDataCenterName = "data_center_name" + vStoragePoolName = "storage_pool_name" // volume Info constants. vID = "id" @@ -211,6 +213,22 @@ func volumeSchema() map[string]*schema.Schema { Computed: true, Description: "The number of active exports for this volume", }, + + vDataCenterName: { + Type: schema.TypeString, + Required: false, + Optional: false, + Computed: true, + Description: "Name of the data center where the volume is created on the storage array.", + }, + + vStoragePoolName: { + Type: schema.TypeString, + Required: false, + Optional: false, + Computed: true, + Description: "Name of the storage pool from where the volume is allocated.", + }, } } diff --git a/version b/version index 02c1916..fe0c4db 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.3.62 +1.3.63 From a47f9b5439bd575da63fde4fcbe8fc201b7fab9e Mon Sep 17 00:00:00 2001 From: Malay Chitranshi Date: Sun, 3 Nov 2024 22:21:44 -0800 Subject: [PATCH 2/2] Addressed review comments. --- go.mod | 2 +- internal/resources/resource_volume.go | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 8db355c..d1d768d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/hewlettpackard/hpegl-metal-terraform-resources -go 1.21.0 +go 1.22.0 toolchain go1.22.5 diff --git a/internal/resources/resource_volume.go b/internal/resources/resource_volume.go index f6de65b..b305a4a 100644 --- a/internal/resources/resource_volume.go +++ b/internal/resources/resource_volume.go @@ -216,16 +216,12 @@ func volumeSchema() map[string]*schema.Schema { vDataCenterName: { Type: schema.TypeString, - Required: false, - Optional: false, Computed: true, Description: "Name of the data center where the volume is created on the storage array.", }, vStoragePoolName: { Type: schema.TypeString, - Required: false, - Optional: false, Computed: true, Description: "Name of the storage pool from where the volume is allocated.", }, @@ -422,6 +418,14 @@ func resourceMetalVolumeRead(d *schema.ResourceData, meta interface{}) (err erro return fmt.Errorf("set %s: %v", vExportCount, err) } + if err = d.Set(vDataCenterName, volume.DataCenterName); err != nil { + return fmt.Errorf("set %s: %v", vDataCenterName, err) + } + + if err = d.Set(vStoragePoolName, volume.StoragePoolName); err != nil { + return fmt.Errorf("set %s: %v", vStoragePoolName, err) + } + d.Set(vName, volume.Name) d.Set(vDescription, volume.Description) flavorName, _ := p.GetVolumeFlavorName(volume.FlavorID)