Skip to content

Commit

Permalink
Merge pull request #4095 from terraform-providers/t-aws_network_acl-p…
Browse files Browse the repository at this point in the history
…revent-subnetchange-crash

tests/resource/aws_network_acl: Prevent crash in TestAccAWSNetworkAcl_SubnetChange
  • Loading branch information
bflad authored Apr 12, 2018
2 parents ddbbcc2 + e4335e1 commit 90a0813
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 @@ -500,7 +503,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 90a0813

Please sign in to comment.