From e2283445f2e883dc2403f0022c4504643316240b Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Thu, 24 Oct 2019 16:15:26 -0700 Subject: [PATCH] need to initialize variables scoped to the individual loop, because the address of k,v stay the same and that means we overwrite previous variables when assigning them to the struct directly. --- builder/amazon/common/build_filter.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/builder/amazon/common/build_filter.go b/builder/amazon/common/build_filter.go index 87600b5d0..3801f9d72 100644 --- a/builder/amazon/common/build_filter.go +++ b/builder/amazon/common/build_filter.go @@ -8,9 +8,11 @@ import ( func buildEc2Filters(input map[string]string) []*ec2.Filter { var filters []*ec2.Filter for k, v := range input { + a := k + b := v filters = append(filters, &ec2.Filter{ - Name: &k, - Values: []*string{&v}, + Name: &a, + Values: []*string{&b}, }) } return filters