Merge pull request #3656 from mlosapio/master

Added a hook to query the security groups before launching the instan…
This commit is contained in:
Chris Bednarski 2016-07-01 17:01:42 -07:00 committed by GitHub
commit a20d979eba
1 changed files with 12 additions and 0 deletions

View File

@ -45,6 +45,18 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
securityGroupIds := make([]*string, len(tempSecurityGroupIds)) securityGroupIds := make([]*string, len(tempSecurityGroupIds))
for i, sg := range 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) securityGroupIds[i] = aws.String(sg)
} }