From e4335e1d1934435af6b8b72e52e8c910027014d9 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Fri, 6 Apr 2018 09:30:48 -0400 Subject: [PATCH] tests/resource/aws_network_acl: Prevent crash in TestAccAWSNetworkAcl_SubnetChange --- aws/resource_aws_network_acl_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_network_acl_test.go b/aws/resource_aws_network_acl_test.go index 510488e2286..91f120ce6dc 100644 --- a/aws/resource_aws_network_acl_test.go +++ b/aws/resource_aws_network_acl_test.go @@ -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) }, @@ -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"), ), @@ -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