When creating a GatewayLoadBalancer type VPC endpoint, the AWS provider should wait for the VPC endpoint to reach Available status before marking it as created.
Actual Behavior
The AWS provider creates the VPC endpoint resource correctly but marks the resource as created before the endpoint reaches Available status, leading to errors when referencing the aforementioned VPC endpoint.
Context:
In my example (which is to create a Palo Alto NGFW cloud endpoint), the VPC endpoint being created takes approximately 120-150 seconds to go from Pending to Available status in the AWS console.
As such, when creating a route table that routes to that endpoint, without some sort of delay (such as time_sleep) Terraform will attempt to create the route against the VPC endpoint that is still in Pending status, and it will fail with a misleading error: Route table contains unsupported route target
A second terraform apply run after the VPC endpoint is available will be successful. In order to get around this issue I am currently relying on a time_sleep block that simply waits 3 minutes, and using depends_on to force the route table creation to wait on the VPC endpoint being ready.
Relevant Error/Panic Output Snippet
Error: creating Route in Route Table (rtb-02f8e986bb0f3c207) with destination (0.0.0.0/0): RouteNotSupported: Route table contains unsupported route target: vpce-079b947c19d8fb437. VPC Endpoints of this type cannot be used as route targets.
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
Volunteering to Work on This Issue
If you are interested in working on this issue, please leave a comment.
If this would be your first contribution, please review the contribution guide.
Terraform Core Version
1.4.6
AWS Provider Version
v5.10.0
Affected Resource(s)
AWS VPC endpoints of type
GatewayLoadBalancer
Expected Behavior
When creating a GatewayLoadBalancer type VPC endpoint, the AWS provider should wait for the VPC endpoint to reach
Available
status before marking it as created.Actual Behavior
The AWS provider creates the VPC endpoint resource correctly but marks the resource as created before the endpoint reaches
Available
status, leading to errors when referencing the aforementioned VPC endpoint.Context: In my example (which is to create a Palo Alto NGFW cloud endpoint), the VPC endpoint being created takes approximately 120-150 seconds to go from
Pending
toAvailable
status in the AWS console.As such, when creating a route table that routes to that endpoint, without some sort of delay (such as
time_sleep
) Terraform will attempt to create the route against the VPC endpoint that is still inPending
status, and it will fail with a misleading error:Route table contains unsupported route target
A second
terraform apply
run after the VPC endpoint is available will be successful. In order to get around this issue I am currently relying on atime_sleep
block that simply waits 3 minutes, and usingdepends_on
to force the route table creation to wait on the VPC endpoint being ready.Relevant Error/Panic Output Snippet
Terraform Configuration Files
Steps to Reproduce
terraform apply
the above codeDebug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None