diff --git a/builtin/providers/aws/resource_aws_vpc_test.go b/builtin/providers/aws/resource_aws_vpc_test.go index 57c73a020..ef86449a5 100644 --- a/builtin/providers/aws/resource_aws_vpc_test.go +++ b/builtin/providers/aws/resource_aws_vpc_test.go @@ -17,7 +17,10 @@ func TestAccVpc(t *testing.T) { Steps: []resource.TestStep{ resource.TestStep{ Config: testAccVpcConfig, - Check: testAccCheckVpcExists("aws_vpc.foo"), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists("aws_vpc.foo"), + testAccCheckVpcCidr("aws_vpc.foo", "10.1.0.0/16"), + ), }, }, }) @@ -54,6 +57,26 @@ func testAccCheckVpcDestroy(s *terraform.State) error { return nil } +func testAccCheckVpcCidr(n, expected string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + + v, ok := rs.Attributes["cidr_block"] + if !ok { + return fmt.Errorf("No cidr_block") + } + + if v != expected { + return fmt.Errorf("Bad cidr: %s", v) + } + + return nil + } +} + func testAccCheckVpcExists(n string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.Resources[n]