Merge pull request #1625 from hashicorp/b-panic-network-acl

provider/aws: fix potential panic when finding network ACL
This commit is contained in:
Mitchell Hashimoto 2015-04-22 16:01:57 +02:00
commit 341b2ff864
1 changed files with 5 additions and 4 deletions

View File

@ -185,7 +185,6 @@ func resourceAwsNetworkAclUpdate(d *schema.ResourceData, meta interface{}) error
}
if d.HasChange("subnet_id") {
//associate new subnet with the acl.
_, n := d.GetChange("subnet_id")
newSubnet := n.(string)
@ -355,10 +354,12 @@ func findNetworkAclAssociation(subnetId string, conn *ec2.EC2) (networkAclAssoci
if err != nil {
return nil, err
}
if resp.NetworkACLs != nil && len(resp.NetworkACLs) > 0 {
for _, association := range resp.NetworkACLs[0].Associations {
if *association.SubnetID == subnetId {
return association, nil
}
}
}
return nil, fmt.Errorf("could not find association for subnet %s ", subnetId)
}