In Amazon builders, allow tag names to be interpolated like values

This commit is contained in:
Zanetti, David 2017-09-25 02:24:23 +00:00
parent 7d10c98a38
commit 42dc1e4795
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, SourceAMI: sourceAmiId,
BuildRegion: region, 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) interpolatedValue, err := interpolate.Render(value, &ctx)
if err != nil { if err != nil {
return ec2Tags, fmt.Errorf("Error processing tag: %s:%s - %s", key, value, err) return ec2Tags, fmt.Errorf("Error processing tag: %s:%s - %s", key, value, err)
} }
ec2Tags = append(ec2Tags, &ec2.Tag{ ec2Tags = append(ec2Tags, &ec2.Tag{
Key: aws.String(key), Key: aws.String(interpolatedKey),
Value: aws.String(interpolatedValue), Value: aws.String(interpolatedValue),
}) })
} }