From 3d6d94e468af1dbd94e6cedb65d05661944ed73b Mon Sep 17 00:00:00 2001 From: Michaela Date: Tue, 26 Oct 2021 11:46:10 +1100 Subject: [PATCH] add lb --- lb.tf | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 lb.tf diff --git a/lb.tf b/lb.tf new file mode 100644 index 0000000..71d4885 --- /dev/null +++ b/lb.tf @@ -0,0 +1,50 @@ +# Shared load balancer +resource "aws_lb" "ws" { + name = "ws" + internal = false + load_balancer_type = "application" + security_groups = [aws_security_group.lb.id] + subnets = values(aws_subnet.public)[*].id + + enable_deletion_protection = true + +} + +resource "aws_security_group" "lb" { + ingress = [ + { + from_port = 443 + to_port = 443 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + ipv6_cidr_blocks = ["::/0"] + description = "" + prefix_list_ids = [] + self = false + security_groups = [] + } + ] + egress = [ + { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + ipv6_cidr_blocks = ["::/0"] + description = "" + prefix_list_ids = [] + self = false + security_groups = [] + } + ] + vpc_id = aws_vpc.main.id + + lifecycle { + ignore_changes = [description, name] + } + +} + +# TODO +# listener +# lsitener rules \ No newline at end of file