Merge pull request #9357 from mrwacky42/f/vpce-empty-rtb
Allow empty route_table_ids list in aws_vpc_endpoint resources
This commit is contained in:
commit
e6c2b7f19c
|
@ -59,9 +59,15 @@ func resourceAwsVpcEndpoint() *schema.Resource {
|
|||
func resourceAwsVPCEndpointCreate(d *schema.ResourceData, meta interface{}) error {
|
||||
conn := meta.(*AWSClient).ec2conn
|
||||
input := &ec2.CreateVpcEndpointInput{
|
||||
VpcId: aws.String(d.Get("vpc_id").(string)),
|
||||
RouteTableIds: expandStringList(d.Get("route_table_ids").(*schema.Set).List()),
|
||||
ServiceName: aws.String(d.Get("service_name").(string)),
|
||||
VpcId: aws.String(d.Get("vpc_id").(string)),
|
||||
ServiceName: aws.String(d.Get("service_name").(string)),
|
||||
}
|
||||
|
||||
if v, ok := d.GetOk("route_table_ids"); ok {
|
||||
list := v.(*schema.Set).List()
|
||||
if len(list) > 0 {
|
||||
input.RouteTableIds = expandStringList(list)
|
||||
}
|
||||
}
|
||||
|
||||
if v, ok := d.GetOk("policy"); ok {
|
||||
|
|
|
@ -139,6 +139,26 @@ func testAccCheckVpcEndpointPrefixListAvailable(n string) resource.TestCheckFunc
|
|||
}
|
||||
}
|
||||
|
||||
func TestAccAWSVpcEndpointWithoutRouteTableOrPolicyConfig(t *testing.T) {
|
||||
var endpoint ec2.VpcEndpoint
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
IDRefreshName: "aws_vpc_endpoint.second-private-s3",
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckVpcEndpointDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: testAccVpcEndpointWithoutRouteTableOrPolicyConfig,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckVpcEndpointExists("aws_vpc_endpoint.second-private-s3", &endpoint),
|
||||
testAccCheckVpcEndpointPrefixListAvailable("aws_vpc_endpoint.second-private-s3"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const testAccVpcEndpointWithRouteTableAndPolicyConfig = `
|
||||
resource "aws_vpc" "foo" {
|
||||
cidr_block = "10.0.0.0/16"
|
||||
|
@ -227,3 +247,14 @@ resource "aws_route_table_association" "main" {
|
|||
route_table_id = "${aws_route_table.default.id}"
|
||||
}
|
||||
`
|
||||
|
||||
const testAccVpcEndpointWithoutRouteTableOrPolicyConfig = `
|
||||
resource "aws_vpc" "foo" {
|
||||
cidr_block = "10.0.0.0/16"
|
||||
}
|
||||
|
||||
resource "aws_vpc_endpoint" "second-private-s3" {
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
service_name = "com.amazonaws.us-west-2.s3"
|
||||
}
|
||||
`
|
||||
|
|
Loading…
Reference in New Issue