diff --git a/.changelog/30994.txt b/.changelog/30994.txt new file mode 100644 index 000000000000..31c204dca833 --- /dev/null +++ b/.changelog/30994.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_vpc_endpoint_route_table_association: Retry resource Create for EC2 eventual consistency +``` \ No newline at end of file diff --git a/internal/service/ec2/vpc_endpoint_route_table_association.go b/internal/service/ec2/vpc_endpoint_route_table_association.go index 722aef8ec66f..03dc85761e8a 100644 --- a/internal/service/ec2/vpc_endpoint_route_table_association.go +++ b/internal/service/ec2/vpc_endpoint_route_table_association.go @@ -57,7 +57,6 @@ func resourceVPCEndpointRouteTableAssociationCreate(ctx context.Context, d *sche log.Printf("[DEBUG] Creating VPC Endpoint Route Table Association: %s", input) _, err := conn.ModifyVpcEndpointWithContext(ctx, input) - if err != nil { return sdkdiag.AppendErrorf(diags, "creating VPC Endpoint Route Table Association (%s): %s", id, err) } @@ -82,7 +81,9 @@ func resourceVPCEndpointRouteTableAssociationRead(ctx context.Context, d *schema // Human friendly ID for error messages since d.Id() is non-descriptive id := fmt.Sprintf("%s/%s", endpointID, routeTableID) - err := FindVPCEndpointRouteTableAssociationExists(ctx, conn, endpointID, routeTableID) + _, err := tfresource.RetryWhenNewResourceNotFound(ctx, RouteTableAssociationPropagationTimeout, func() (interface{}, error) { + return nil, FindVPCEndpointRouteTableAssociationExists(ctx, conn, endpointID, routeTableID) + }, d.IsNewResource()) if !d.IsNewResource() && tfresource.NotFound(err) { log.Printf("[WARN] VPC Endpoint Route Table Association (%s) not found, removing from state", id)