resource "aws_security_group" "web" { name = "${var.project_name}-web" description = "SSH (restricted), HTTP and HTTPS" vpc_id = aws_vpc.this.id ingress { description = "SSH" from_port = 22 to_port = 22 protocol = "tcp" cidr_blocks = [var.allowed_ssh_cidr] } ingress { description = "HTTP (ACME challenge + redirect to HTTPS)" from_port = 80 to_port = 80 protocol = "tcp" cidr_blocks = ["0.0.0.0/0"] } ingress { description = "HTTPS" from_port = 443 to_port = 443 protocol = "tcp" cidr_blocks = ["0.0.0.0/0"] } egress { description = "All outbound" from_port = 0 to_port = 0 protocol = "-1" cidr_blocks = ["0.0.0.0/0"] } tags = merge(local.tags, { Name = "${var.project_name}-web" }) }