Merge pull request #3396 from hashicorp/f-aws-reenable-test

provider/aws: Renable TestAccAWSRouteTable_vpcPeering
This commit is contained in:
Clint 2015-10-02 16:51:35 -05:00
commit cf98cbc9ad
1 changed files with 31 additions and 8 deletions

View File

@ -2,6 +2,7 @@ package aws
import (
"fmt"
"os"
"testing"
"github.com/aws/aws-sdk-go/aws"
@ -212,12 +213,16 @@ func testAccCheckRouteTableExists(n string, v *ec2.RouteTable) resource.TestChec
}
}
// TODO: re-enable this test.
// VPC Peering connections are prefixed with pcx
// Right now there is no VPC Peering resource
func _TestAccAWSRouteTable_vpcPeering(t *testing.T) {
func TestAccAWSRouteTable_vpcPeering(t *testing.T) {
var v ec2.RouteTable
acctId := os.Getenv("TF_ACC_ID")
if acctId == "" {
t.Fatal("Error: Test TestAccAWSRouteTable_vpcPeering requires an Account ID in TF_ACC_ID ")
}
testCheck := func(*terraform.State) error {
if len(v.Routes) != 2 {
return fmt.Errorf("bad routes: %#v", v.Routes)
@ -243,7 +248,7 @@ func _TestAccAWSRouteTable_vpcPeering(t *testing.T) {
CheckDestroy: testAccCheckRouteTableDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: testAccRouteTableVpcPeeringConfig,
Config: testAccRouteTableVpcPeeringConfig(acctId),
Check: resource.ComposeTestCheckFunc(
testAccCheckRouteTableExists(
"aws_route_table.foo", &v),
@ -395,11 +400,10 @@ resource "aws_route_table" "foo" {
}
`
// TODO: re-enable this test.
// VPC Peering connections are prefixed with pcx
// Right now there is no VPC Peering resource
const testAccRouteTableVpcPeeringConfig = `
resource "aws_vpc" "foo" {
// This test requires an ENV var, TF_ACC_ID, with a valid AWS Account ID
func testAccRouteTableVpcPeeringConfig(acc string) string {
cfg := `resource "aws_vpc" "foo" {
cidr_block = "10.1.0.0/16"
}
@ -407,15 +411,34 @@ resource "aws_internet_gateway" "foo" {
vpc_id = "${aws_vpc.foo.id}"
}
resource "aws_vpc" "bar" {
cidr_block = "10.3.0.0/16"
}
resource "aws_internet_gateway" "bar" {
vpc_id = "${aws_vpc.bar.id}"
}
resource "aws_vpc_peering_connection" "foo" {
vpc_id = "${aws_vpc.foo.id}"
peer_vpc_id = "${aws_vpc.bar.id}"
peer_owner_id = "%s"
tags {
foo = "bar"
}
}
resource "aws_route_table" "foo" {
vpc_id = "${aws_vpc.foo.id}"
route {
cidr_block = "10.2.0.0/16"
vpc_peering_connection_id = "pcx-12345"
vpc_peering_connection_id = "${aws_vpc_peering_connection.foo.id}"
}
}
`
return fmt.Sprintf(cfg, acc)
}
const testAccRouteTableVgwRoutePropagationConfig = `
resource "aws_vpc" "foo" {