Skip to content

Commit

Permalink
DE24092: volume: add export count attribute (#222)
Browse files Browse the repository at this point in the history
* volume: add export count attribute

* mod: updated metal client to v1.5.23

* mod: go mod tidy
  • Loading branch information
achu-1612 authored Sep 24, 2024
1 parent 419e2c7 commit 34c384a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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.22
github.com/hewlettpackard/hpegl-metal-client v1.5.23
github.com/hewlettpackard/hpegl-provider-lib v0.0.18
github.com/stretchr/testify v1.9.0
gopkg.in/yaml.v2 v2.4.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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.22 h1:EW19Adpfroi27jpYYjlNddx/TwGKnTVysd5Lpqoo/ls=
github.com/hewlettpackard/hpegl-metal-client v1.5.22/go.mod h1:+BO4BfQXf3IWnsxvk2IdE27Ijrm1jDVYIgpebYh1L9M=
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-provider-lib v0.0.18 h1:87iXgq8Oe2ebBRicL5K+HknQF9e1ce6MHfIHeTVVqlI=
github.com/hewlettpackard/hpegl-provider-lib v0.0.18/go.mod h1:Bw2DhefBjqXQI6s5vBBGiWUkFz7fx4KkbGfwmo9wv3U=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
Expand Down
13 changes: 13 additions & 0 deletions internal/resources/resource_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const (
vActiveSite = "active_site"
vCreatedSite = "created_site"
vReplicationEnabled = "replication_enabled"
vExportCount = "export_count"

// volume Info constants.
vID = "id"
Expand Down Expand Up @@ -202,6 +203,14 @@ func volumeSchema() map[string]*schema.Schema {
Computed: true,
Description: "The site where the volume was originally created.",
},

vExportCount: {
Type: schema.TypeInt,
Required: false,
Optional: false,
Computed: true,
Description: "The number of active exports for this volume",
},
}
}

Expand Down Expand Up @@ -391,6 +400,10 @@ func resourceMetalVolumeRead(d *schema.ResourceData, meta interface{}) (err erro
return fmt.Errorf("set %s : %v", vReplicationEnabled, err)
}

if err = d.Set(vExportCount, volume.ExportCount); err != nil {
return fmt.Errorf("set %s: %v", vExportCount, err)
}

d.Set(vName, volume.Name)
d.Set(vDescription, volume.Description)
flavorName, _ := p.GetVolumeFlavorName(volume.FlavorID)
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.61
1.3.62

0 comments on commit 34c384a

Please sign in to comment.