providers/aws/aws_security_group: we need to check for one other error

This commit is contained in:
Mitchell Hashimoto 2014-07-17 11:28:40 -07:00
parent 99ac8fc68e
commit 916ca711ad
1 changed files with 9 additions and 4 deletions

View File

@ -205,10 +205,15 @@ func SGStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
sgs := []ec2.SecurityGroup{ec2.SecurityGroup{Id: id}}
resp, err := conn.SecurityGroups(sgs, nil)
if err != nil {
if ec2err, ok := err.(*ec2.Error); ok &&
ec2err.Code == "InvalidSecurityGroupID.NotFound" {
resp = nil
} else {
if ec2err, ok := err.(*ec2.Error); ok {
if ec2err.Code == "InvalidSecurityGroupID.NotFound" ||
ec2err.Code == "InvalidGroup.NotFound" {
resp = nil
err = nil
}
}
if err != nil {
log.Printf("Error on SGStateRefresh: %s", err)
return nil, "", err
}