Added a hook to query the security groups before launching the instance - seems to catch the AWS eventual consistency nicely

pull/3656/head
Mike LoSapio 10 years ago
parent 8e2bca030c
commit 080806243e

@ -45,6 +45,18 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
securityGroupIds := make([]*string, len(tempSecurityGroupIds))
for i, sg := range tempSecurityGroupIds {
for i := 0; i < 5; i++ {
log.Printf("Describing tempSecurityGroup to ensure it is available: %s", sg)
_, err := ec2conn.DescribeSecurityGroups(&ec2.DescribeSecurityGroupsInput{
GroupIds: []*string{aws.String(sg)},
})
if err == nil {
log.Printf("Found security group %s", sg)
break
}
log.Printf("Error in querying security group %s", err)
time.Sleep(5 * time.Second)
}
securityGroupIds[i] = aws.String(sg)
}

Loading…
Cancel
Save