From 916ca711ad3016ea0ef97809157b1cd12e823c88 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 17 Jul 2014 11:28:40 -0700 Subject: [PATCH] providers/aws/aws_security_group: we need to check for one other error --- .../providers/aws/resource_aws_security_group.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/builtin/providers/aws/resource_aws_security_group.go b/builtin/providers/aws/resource_aws_security_group.go index 8905b6f8fa..14d57d6207 100644 --- a/builtin/providers/aws/resource_aws_security_group.go +++ b/builtin/providers/aws/resource_aws_security_group.go @@ -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 }