verify given security group

This commit is contained in:
Matthew Hooker 2017-01-18 15:25:31 -08:00
parent b265d2614f
commit 56b5e97bf4
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 11 additions and 0 deletions

View File

@ -27,6 +27,17 @@ func (s *StepSecurityGroup) Run(state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packer.Ui) ui := state.Get("ui").(packer.Ui)
if len(s.SecurityGroupIds) > 0 { if len(s.SecurityGroupIds) > 0 {
_, err := ec2conn.DescribeSecurityGroups(
&ec2.DescribeSecurityGroupsInput{
GroupIds: aws.StringSlice(s.SecurityGroupIds),
},
)
if err != nil {
err := fmt.Errorf("Couldn't find specified security group: %s", err)
log.Printf("[DEBUG] %s", err.Error())
state.Put("error", err)
return multistep.ActionHalt
}
log.Printf("Using specified security groups: %v", s.SecurityGroupIds) log.Printf("Using specified security groups: %v", s.SecurityGroupIds)
state.Put("securityGroupIds", s.SecurityGroupIds) state.Put("securityGroupIds", s.SecurityGroupIds)
return multistep.ActionContinue return multistep.ActionContinue