Merge branch 'BSick7-b/4311'
This commit is contained in:
commit
c5ea6d0fb9
|
@ -40,16 +40,19 @@ func resourceAwsRoute() *schema.Resource {
|
||||||
"gateway_id": &schema.Schema{
|
"gateway_id": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"nat_gateway_id": &schema.Schema{
|
"nat_gateway_id": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"instance_id": &schema.Schema{
|
"instance_id": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"instance_owner_id": &schema.Schema{
|
"instance_owner_id": &schema.Schema{
|
||||||
|
@ -60,6 +63,7 @@ func resourceAwsRoute() *schema.Resource {
|
||||||
"network_interface_id": &schema.Schema{
|
"network_interface_id": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
"origin": &schema.Schema{
|
"origin": &schema.Schema{
|
||||||
|
|
|
@ -32,7 +32,9 @@ func TestAccAWSRoute_basic(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() {
|
||||||
|
testAccPreCheck(t)
|
||||||
|
},
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
CheckDestroy: testAccCheckAWSRouteDestroy,
|
CheckDestroy: testAccCheckAWSRouteDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
|
@ -93,7 +95,9 @@ func TestAccAWSRoute_changeCidr(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() {
|
||||||
|
testAccPreCheck(t)
|
||||||
|
},
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
CheckDestroy: testAccCheckAWSRouteDestroy,
|
CheckDestroy: testAccCheckAWSRouteDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
|
@ -116,6 +120,44 @@ func TestAccAWSRoute_changeCidr(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAccAWSRoute_noopdiff(t *testing.T) {
|
||||||
|
var route ec2.Route
|
||||||
|
var routeTable ec2.RouteTable
|
||||||
|
|
||||||
|
testCheck := func(s *terraform.State) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
testCheckChange := func(s *terraform.State) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
resource.Test(t, resource.TestCase{
|
||||||
|
PreCheck: func() {
|
||||||
|
testAccPreCheck(t)
|
||||||
|
},
|
||||||
|
Providers: testAccProviders,
|
||||||
|
CheckDestroy: testAccCheckAWSRouteDestroy,
|
||||||
|
Steps: []resource.TestStep{
|
||||||
|
resource.TestStep{
|
||||||
|
Config: testAccAWSRouteNoopChange,
|
||||||
|
Check: resource.ComposeTestCheckFunc(
|
||||||
|
testAccCheckAWSRouteExists("aws_route.test", &route),
|
||||||
|
testCheck,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
resource.TestStep{
|
||||||
|
Config: testAccAWSRouteNoopChange,
|
||||||
|
Check: resource.ComposeTestCheckFunc(
|
||||||
|
testAccCheckAWSRouteExists("aws_route.test", &route),
|
||||||
|
testAccCheckRouteTableExists("aws_route_table.test", &routeTable),
|
||||||
|
testCheckChange,
|
||||||
|
),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Acceptance test if mixed inline and external routes are implemented
|
// Acceptance test if mixed inline and external routes are implemented
|
||||||
/*
|
/*
|
||||||
func TestAccAWSRoute_mix(t *testing.T) {
|
func TestAccAWSRoute_mix(t *testing.T) {
|
||||||
|
@ -296,3 +338,30 @@ resource "aws_route" "bar" {
|
||||||
gateway_id = "${aws_internet_gateway.foo.id}"
|
gateway_id = "${aws_internet_gateway.foo.id}"
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
var testAccAWSRouteNoopChange = fmt.Sprint(`
|
||||||
|
resource "aws_vpc" "test" {
|
||||||
|
cidr_block = "10.10.0.0/16"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_route_table" "test" {
|
||||||
|
vpc_id = "${aws_vpc.test.id}"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_subnet" "test" {
|
||||||
|
vpc_id = "${aws_vpc.test.id}"
|
||||||
|
cidr_block = "10.10.10.0/24"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_route" "test" {
|
||||||
|
route_table_id = "${aws_route_table.test.id}"
|
||||||
|
destination_cidr_block = "0.0.0.0/0"
|
||||||
|
instance_id = "${aws_instance.nat.id}"
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_instance" "nat" {
|
||||||
|
ami = "ami-9abea4fb"
|
||||||
|
instance_type = "t2.nano"
|
||||||
|
subnet_id = "${aws_subnet.test.id}"
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
Loading…
Reference in New Issue