Merge pull request #5381 from dave2/gh-5320

(GH-5320) In Amazon builders, allow tag names to be interpolated like values
This commit is contained in:
Matthew Hooker 2017-09-25 16:06:54 -05:00 committed by GitHub
commit 6e96879640
1 changed files with 5 additions and 1 deletions

View File

@ -166,13 +166,17 @@ func ConvertToEC2Tags(tags map[string]string, region, sourceAmiId string, ctx in
SourceAMI: sourceAmiId,
BuildRegion: region,
}
interpolatedKey, err := interpolate.Render(key, &ctx)
if err != nil {
return ec2Tags, fmt.Errorf("Error processing tag: %s:%s - %s", key, value, err)
}
interpolatedValue, err := interpolate.Render(value, &ctx)
if err != nil {
return ec2Tags, fmt.Errorf("Error processing tag: %s:%s - %s", key, value, err)
}
ec2Tags = append(ec2Tags, &ec2.Tag{
Key: aws.String(key),
Key: aws.String(interpolatedKey),
Value: aws.String(interpolatedValue),
})
}