我正在尝试使用 Terraform v0.11.0 创建 na NLB(我的应用程序不使用 HTTP,所以我不能使用 ALB)。查看 Hashcorp 文档,我可以创建以下代码:
resource "aws_lb" "lb" {
name = "test"
internal = false
enable_deletion_protection = true
load_balancer_type = "network"
ip_address_type = "ipv4"
subnet_mapping {
subnet_id = "${data.aws_subnet.sn-app-1.id}"
allocation_id = "${aws_eip.eip-1.id}"
}
subnet_mapping {
subnet_id = "${data.aws_subnet.sn-app-2.id}"
allocation_id = "${aws_eip.eip-2.id}"
}
}
resource "aws_lb_target_group" "lbtg" {
name = "test"
port = "8080"
protocol = "TCP"
vpc_id = "${data.aws_vpc.vpc.id}"
deregistration_delay = "300"
health_check {
interval = "300"
port = "8080"
protocol = "TCP"
timeout = …Run Code Online (Sandbox Code Playgroud)