From 4a03d90e2a3a4206827bde02784e4458249704f4 Mon Sep 17 00:00:00 2001 From: Jie Yu Date: Fri, 23 Aug 2019 15:25:56 -0700 Subject: [PATCH] Fix a bug if there are multiple volume tags We cannot take the address of a range iteration variable because the address of that will be the same. --- pkg/cloud/cloud.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/cloud/cloud.go b/pkg/cloud/cloud.go index b9fd8150b7..a24c549f15 100644 --- a/pkg/cloud/cloud.go +++ b/pkg/cloud/cloud.go @@ -279,7 +279,9 @@ func (c *cloud) CreateDisk(ctx context.Context, volumeName string, diskOptions * var tags []*ec2.Tag for key, value := range diskOptions.Tags { - tags = append(tags, &ec2.Tag{Key: &key, Value: &value}) + copiedKey := key + copiedValue := value + tags = append(tags, &ec2.Tag{Key: &copiedKey, Value: &copiedValue}) } tagSpec := ec2.TagSpecification{ ResourceType: aws.String("volume"),