I retrieve the subnet ids from the dev account to attach NLB to them afterwards. There are two subnets per each AZ. Therefore, I get the "Error creating network Load Balancer: InvalidConfigurationRequest: A load balancer cannot be attached to multiple subnets in the same Availability Zone". I need to filter on the subnet names to exclude certain characters ("-lb-") in the name and only use the ones without the "-lb-". I know Terraform can use for_each argument and toset() function but does it have something like contains or where clauses similar to LINQ?
data "aws_subnet_ids" "dev_subnets" {
vpc_id = data.aws_vpc.dev_account_vpc.id
}
and
resource "aws_lb" "dev_network_load_balancer" {
name = "my-nlb"
internal = true
load_balancer_type = "network"
subnets = data.aws_subnet_ids.dev_subnets.ids
...
}