Add aws_vpc_endpoint ENI to route table

Hello,

I’m trying to add an aws_vpc_endpoint ENI as a route table next-hop, in the same module.

I’m using the network_interface_ids from aws_vpc_endpoint in my aws_route_table but each time it errors with
“Inappropriate value for attribute “network_interface_id”: string required.”

My latest config snippets are below:

#main.tf
resource “aws_vpc_endpoint” “vpce1” {
}

resource “aws_route_table” “TransitVPC-USW2-AttSubnetRT1” {
vpc_id = aws_vpc.TransitVPC-USW2.id
}
route {
cidr_block = “0.0.0.0/0”
network_interface_id = data.aws_vpc_endpoint.data_vpce1.network_interface_ids
}
}

#datasource.tf
data “aws_vpc_endpoint” “data_vpce1” {
id = aws_vpc_endpoint.vpce1.id
}

Thanks