Skip to content

Commit

Permalink
tests/resource/aws_network_acl: Prevent crash in TestAccAWSNetworkAcl…
Browse files Browse the repository at this point in the history
…_SubnetChange
  • Loading branch information
bflad committed Apr 6, 2018
1 parent 0e099c6 commit e4335e1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion aws/resource_aws_network_acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ func TestAccAWSNetworkAcl_OnlyEgressRules(t *testing.T) {
}

func TestAccAWSNetworkAcl_SubnetChange(t *testing.T) {
var networkAcl ec2.NetworkAcl

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -285,12 +286,14 @@ func TestAccAWSNetworkAcl_SubnetChange(t *testing.T) {
{
Config: testAccAWSNetworkAclSubnetConfig,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSNetworkAclExists("aws_network_acl.bar", &networkAcl),
testAccCheckSubnetIsAssociatedWithAcl("aws_network_acl.bar", "aws_subnet.old"),
),
},
{
Config: testAccAWSNetworkAclSubnetConfigChange,
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSNetworkAclExists("aws_network_acl.bar", &networkAcl),
testAccCheckSubnetIsNotAssociatedWithAcl("aws_network_acl.bar", "aws_subnet.old"),
testAccCheckSubnetIsAssociatedWithAcl("aws_network_acl.bar", "aws_subnet.new"),
),
Expand Down Expand Up @@ -459,7 +462,7 @@ func testAccCheckAWSNetworkAclExists(n string, networkAcl *ec2.NetworkAcl) resou
}

if rs.Primary.ID == "" {
return fmt.Errorf("No Security Group is set")
return fmt.Errorf("No ID is set: %s", n)
}
conn := testAccProvider.Meta().(*AWSClient).ec2conn

Expand Down

0 comments on commit e4335e1

Please sign in to comment.