resource "aws_network_interface" "fw_data" { for_each = local.subnets subnet_id = aws_subnet.fwdata[each.key].id security_groups = [aws_security_group.fwdata.id] source_dest_check = false } resource "aws_instance" "fw" { for_each = local.subnets instance_type = "m5.xlarge" network_interface { network_interface_id = ...fw_mgmt[each.key].id, device_index = 0 } network_interface { network_interface_id = ...fw_data[each.key].id, device_index = 1 } user_data = <<-EOT type=dhcp-client hostname=fw-gwlb-${each.key} dhcp-accept-server-hostname=no dhcp-accept-server-domain=no EOT }