From b977f7fd245f80fefa2bf02d0e213183b80f19c4 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 11 Dec 2024 09:02:18 +0530 Subject: [PATCH] Update resource_ibm_is_volume.go --- ibm/service/vpc/resource_ibm_is_volume.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ibm/service/vpc/resource_ibm_is_volume.go b/ibm/service/vpc/resource_ibm_is_volume.go index 2549aebded..2b5242348d 100644 --- a/ibm/service/vpc/resource_ibm_is_volume.go +++ b/ibm/service/vpc/resource_ibm_is_volume.go @@ -487,6 +487,12 @@ 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) @@ -494,12 +500,20 @@ func volCreate(d *schema.ResourceData, meta interface{}, volName, profile, zone 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 {