Skip to content

Commit b977f7f

Browse files
uibmhkantare
authored andcommitted
Update resource_ibm_is_volume.go
1 parent 555c18d commit b977f7f

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

ibm/service/vpc/resource_ibm_is_volume.go

+16-2
Original file line numberDiff line numberDiff line change
@@ -487,19 +487,33 @@ func volCreate(d *schema.ResourceData, meta interface{}, volName, profile, zone
487487
ID: &sourceSnapshot,
488488
}
489489
volTemplate.SourceSnapshot = snapshotIdentity
490+
if capacity, ok := d.GetOk(isVolumeCapacity); ok {
491+
if int64(capacity.(int)) > 0 {
492+
volCapacity := int64(capacity.(int))
493+
volTemplate.Capacity = &volCapacity
494+
}
495+
}
490496
} else if sourceSnapshtCrn, ok := d.GetOk(isVolumeSourceSnapshotCrn); ok {
491497
sourceSnapshot := sourceSnapshtCrn.(string)
492498

493499
snapshotIdentity := &vpcv1.SnapshotIdentity{
494500
CRN: &sourceSnapshot,
495501
}
496502
volTemplate.SourceSnapshot = snapshotIdentity
497-
}
498-
if capacity, ok := d.GetOk(isVolumeCapacity); ok {
503+
if capacity, ok := d.GetOk(isVolumeCapacity); ok {
504+
if int64(capacity.(int)) > 0 {
505+
volCapacity := int64(capacity.(int))
506+
volTemplate.Capacity = &volCapacity
507+
}
508+
}
509+
} else if capacity, ok := d.GetOk(isVolumeCapacity); ok {
499510
if int64(capacity.(int)) > 0 {
500511
volCapacity := int64(capacity.(int))
501512
volTemplate.Capacity = &volCapacity
502513
}
514+
} else {
515+
volCapacity := int64(100)
516+
volTemplate.Capacity = &volCapacity
503517
}
504518

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

0 commit comments

Comments
 (0)