Address PR feedback on #194

This commit is contained in:
Luke Hoban 2017-06-03 14:47:27 -07:00
parent ee987c9961
commit 9f4d48b8f8
2 changed files with 11 additions and 7 deletions

View file

@ -174,12 +174,16 @@ func (p *instanceProvider) Get(ctx context.Context, id resource.ID) (*ec2.Instan
secgrpIDs = &ids
}
var tags []ec2.Tag
for _, tag := range inst.Tags {
tags = append(tags, ec2.Tag{
Key: aws.StringValue(tag.Key),
Value: aws.StringValue(tag.Value),
})
var instanceTags *[]ec2.Tag
if len(inst.Tags) > 0 {
var tags []ec2.Tag
for _, tag := range inst.Tags {
tags = append(tags, ec2.Tag{
Key: aws.StringValue(tag.Key),
Value: aws.StringValue(tag.Value),
})
}
instanceTags = &tags
}
instanceType := ec2.InstanceType(aws.StringValue(inst.InstanceType))
@ -193,7 +197,7 @@ func (p *instanceProvider) Get(ctx context.Context, id resource.ID) (*ec2.Instan
PublicDNSName: inst.PublicDnsName,
PrivateIP: inst.PrivateIpAddress,
PublicIP: inst.PublicIpAddress,
Tags: &tags,
Tags: instanceTags,
}, nil
}