how to Get private IPs from ENIs which got created for RDS instance and attach to NLB . it tried below it dint work
data "aws_network_interfaces" "get-eni" {
filter {
name = "subnet-id"
values = [aws_subnet.customer_subnet_1.id, aws_subnet.customer_subnet_2.id]
}
filter {
name = "description"
values = ["RDSNetworkInterface"]
}
}
resource "aws_lb_target_group_attachment" "tga-pac" {
target_group_arn = aws_lb_target_group.tg-pac.arn
port = 5432
target_id = formatlist("%s/32", [for eni in data.aws_network_interface.get-eni : eni.private_ip])
depends_on = [aws_db_instance.pac_postgres]
Error: Reference to undeclared resource
on nlb.tf line 48, in resource "aws_lb_target_group_attachment" "tga-pac":
48: target_id = [data.aws_network_interface.get-eni.private_ip]
A data resource "aws_network_interface" "get-eni" has not been declared in the
root module.