Skip to content

Commit

Permalink
Update resource_ibm_is_volume.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwal-ibm committed Dec 11, 2024
1 parent d35f348 commit 048af36
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions ibm/service/vpc/resource_ibm_is_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,19 +487,33 @@ func volCreate(d *schema.ResourceData, meta interface{}, volName, profile, zone
ID: &sourceSnapshot,
}
volTemplate.SourceSnapshot = snapshotIdentity
if capacity, ok := d.GetOk(isVolumeCapacity); ok {
if int64(capacity.(int)) > 0 {
volCapacity := int64(capacity.(int))
volTemplate.Capacity = &volCapacity
}
}
} else if sourceSnapshtCrn, ok := d.GetOk(isVolumeSourceSnapshotCrn); ok {
sourceSnapshot := sourceSnapshtCrn.(string)

snapshotIdentity := &vpcv1.SnapshotIdentity{
CRN: &sourceSnapshot,
}
volTemplate.SourceSnapshot = snapshotIdentity
}
if capacity, ok := d.GetOk(isVolumeCapacity); ok {
if capacity, ok := d.GetOk(isVolumeCapacity); ok {
if int64(capacity.(int)) > 0 {
volCapacity := int64(capacity.(int))
volTemplate.Capacity = &volCapacity
}
}
} else if capacity, ok := d.GetOk(isVolumeCapacity); ok {
if int64(capacity.(int)) > 0 {
volCapacity := int64(capacity.(int))
volTemplate.Capacity = &volCapacity
}
} else {
volCapacity := int64(100)
volTemplate.Capacity = &volCapacity
}

if key, ok := d.GetOk(isVolumeEncryptionKey); ok {
Expand Down

0 comments on commit 048af36

Please sign in to comment.