From bffde0f5e7cc4db91e56bba709a6a02f656568e4 Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Fri, 24 Jul 2026 16:39:41 +0200 Subject: [PATCH] fix type deference when calling ebs modify volume endpoint (#3140) * fix type deference when calling ebs modify volume endpoint * only pass set variable to modify input --- pkg/util/volumes/ebs.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/util/volumes/ebs.go b/pkg/util/volumes/ebs.go index bb7506d93..212ee8ac4 100644 --- a/pkg/util/volumes/ebs.go +++ b/pkg/util/volumes/ebs.go @@ -155,23 +155,32 @@ func (r *EBSVolumeResizer) ResizeVolume(volumeID string, newSize int64) error { // ModifyVolume Modify EBS volume func (r *EBSVolumeResizer) ModifyVolume(volumeID string, newType *string, newSize *int64, iops *int64, throughput *int64) error { - /* first check if the volume is already of a requested size */ var sizeInt32 *int32 var iopsInt32 *int32 var throughputInt32 *int32 + + input := ec2.ModifyVolumeInput{ + VolumeId: &volumeID, + } if newSize != nil { s := int32(*newSize) sizeInt32 = &s + input.Size = sizeInt32 } if iops != nil { i := int32(*iops) iopsInt32 = &i + input.Iops = iopsInt32 } if throughput != nil { t := int32(*throughput) throughputInt32 = &t + input.Throughput = throughputInt32 } - input := ec2.ModifyVolumeInput{Size: sizeInt32, VolumeId: &volumeID, VolumeType: types.VolumeType(*newType), Iops: iopsInt32, Throughput: throughputInt32} + if newType != nil { + input.VolumeType = types.VolumeType(*newType) + } + output, err := r.connection.ModifyVolume(context.TODO(), &input) if err != nil { return fmt.Errorf("could not modify persistent volume: %v", err)