Provider: AWS
Region: us-east-1
Terraform: v1.0.4
When attempting to create a route table:
resource "aws_vpc_endpoint_route_table_association" "dynamodb_route_table" {
count = "${length(module.vpc.private_route_table_ids)}"
vpc_endpoint_id = aws_vpc_endpoint.dynamodb_connection.id
route_table_id = "${element(module.vpc.private_route_table_ids, count.index)}"
depends_on = [aws_vpc_endpoint.dynamodb_connection]
}
with the following route:
resource "aws_route" "subnet_to_vpce" {
count = "${length(module.vpc.private_route_table_ids)}"
route_table_id = "${element(module.vpc.private_route_table_ids, count.index)}"
vpc_endpoint_id = aws_vpc_endpoint.dynamodb_connection.id
destination_cidr_block = "${element(module.vpc.private_subnets_cidr_blocks, count.index)}"
depends_on = [aws_vpc_endpoint.dynamodb_connection]
}
which reference the vpc endpoint created in the following way:
resource "aws_vpc_endpoint" "dynamodb_connection" {
vpc_id = module.vpc.vpc_id
service_name = "com.amazonaws.${var.aws_region}.dynamodb"
policy = <<POLICY
{
"Statement": [
{
"Action": "*",
"Effect": "Allow",
"Resource": "*",
"Principal": "*"
}
]
}
POLICY
}
I get the following error:
Error: error creating Route in Route Table (rtb-xxxxxxxxxxxxxxxxx) with destination (10.xx.x.x/24): InvalidVpcEndpointId.NotFound: The vpcEndpoint ID 'vpce-xxxxxxxxxxxxxxxxx' does not exist.
However, the vpc endpoint itself was created successfully. I see it in the tfstate file and when I log into the AWS Console and check, I can see the vpc endpoint with the exact id found in the error.
I retried after waiting an hour, but still nothing.
Not sure if I'm doing something wrong or if this is a bug.