- adding a fix for associating public ip addresses to the launch template

This commit is contained in:
Rohith 2019-02-20 11:53:58 +00:00
parent abe01f602e
commit 1e4cc5437a
1 changed files with 6 additions and 1 deletions

View File

@ -76,9 +76,10 @@ func (t *LaunchTemplate) RenderAWS(c *awsup.AWSAPITarget, a, ep, changes *Launch
if t.SSHKey != nil {
lc.KeyName = t.SSHKey.Name
}
var securityGroups []*string
// @step: add the security groups
for _, sg := range t.SecurityGroups {
lc.SecurityGroupIds = append(lc.SecurityGroupIds, sg.ID)
securityGroups = append(securityGroups, sg.ID)
}
// @step: add any tenacy details
if t.Tenancy != nil {
@ -101,7 +102,11 @@ func (t *LaunchTemplate) RenderAWS(c *awsup.AWSAPITarget, a, ep, changes *Launch
&ec2.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{
AssociatePublicIpAddress: t.AssociatePublicIP,
DeleteOnTermination: aws.Bool(true),
DeviceIndex: fi.Int64(0),
Groups: securityGroups,
})
} else {
lc.SecurityGroupIds = securityGroups
}
// @step: add the userdata
if t.UserData != nil {