Skip to content

Commit

Permalink
Added support for sdp profiles in is_volume
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwal-ibm committed Oct 1, 2024
1 parent c26a264 commit 3a492b5
Show file tree
Hide file tree
Showing 16 changed files with 1,164 additions and 95 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ require (
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.7
github.com/IBM/vmware-go-sdk v0.1.2
github.com/IBM/vpc-beta-go-sdk v0.6.0
github.com/IBM/vpc-go-sdk v0.58.0
github.com/IBM/vpc-go-sdk v0.59.0
github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2
github.com/akamai/AkamaiOPEN-edgegrid-golang/v5 v5.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ github.com/IBM/vmware-go-sdk v0.1.2 h1:5lKWFyInWz9e2hwGsoFTEoLa1jYkD30SReN0fQ10w
github.com/IBM/vmware-go-sdk v0.1.2/go.mod h1:2UGPBJju3jiv5VKKBBm9a5L6bzF/aJdKOKAzJ7HaOjA=
github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQyz4uc=
github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA=
github.com/IBM/vpc-go-sdk v0.58.0 h1:Slk1jkcV7tPnf0iECQV2Oja7W8Bom0z7k9M4fMBY4bI=
github.com/IBM/vpc-go-sdk v0.58.0/go.mod h1:swmxiYLT+OfBsBYqJWGeRd6NPmBk4u/het2PZdtzIaw=
github.com/IBM/vpc-go-sdk v0.59.0 h1:1la2LeYy7d2Ea8D5wM9PFFPfqpXn4t2SqJcO27oNA98=
github.com/IBM/vpc-go-sdk v0.59.0/go.mod h1:swmxiYLT+OfBsBYqJWGeRd6NPmBk4u/het2PZdtzIaw=
github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E=
github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc=
github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0=
Expand Down
6 changes: 3 additions & 3 deletions ibm/flex/structures.go
Original file line number Diff line number Diff line change
Expand Up @@ -3023,11 +3023,11 @@ func ResourceVolumeValidate(diff *schema.ResourceDiff) error {
}
}

if profile != "custom" {
if profile != "custom" && profile != "sdp" {
if iops != 0 && diff.NewValueKnown("iops") && diff.HasChange("iops") {
return fmt.Errorf("VolumeError : iops is applicable for only custom volume profiles")
return fmt.Errorf("VolumeError : iops is applicable for only custom/sdp volume profiles")
}
} else {
} else if profile != "sdp" {
if capacity == 0 {
capacity = int64(100)
}
Expand Down
26 changes: 26 additions & 0 deletions ibm/service/vpc/data_source_ibm_is_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ func DataSourceIBMISVolume() *schema.Resource {
Computed: true,
Description: "Indicates whether a running virtual server instance has an attachment to this volume.",
},
// acadia changes
"adjustable_capacity_states": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Description: "The attachment states that support adjustable capacity for this volume.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"adjustable_iops_states": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Description: "The attachment states that support adjustable IOPS for this volume.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
isVolumeAttachmentState: {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -467,6 +484,15 @@ func volumeGet(d *schema.ResourceData, meta interface{}, name string) error {
if vol.HealthState != nil {
d.Set(isVolumeHealthState, *vol.HealthState)
}

if err = d.Set("adjustable_capacity_states", vol.AdjustableCapacityStates); err != nil {
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting adjustable_capacity_states: %s", err), "(Data) ibm_is_volume", "read", "set-adjustable_capacity_states")
}

if err = d.Set("adjustable_iops_states", vol.AdjustableIopsStates); err != nil {
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting adjustable_iops_states: %s", err), "(Data) ibm_is_volume", "read", "set-adjustable_iops_states")
}

return nil
}

Expand Down
Loading

0 comments on commit 3a492b5

Please sign in to comment.