Skip to content

Commit

Permalink
updated webserver SG to restrict incoming 80 to ALB subnets only
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremycook123 committed Aug 25, 2021
1 parent 85fb46e commit 9b46327
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions exercises/exercise3/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,14 @@ resource "aws_security_group" "webserver" {
}

ingress {
description = "80 from anywhere"
description = "80 from public subnets"
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
cidr_blocks = [
#10.0.0.0/23 covers both pubic subnets
cidrsubnet(var.cidr_block, 7, 0)
]
}

egress {
Expand Down Expand Up @@ -211,10 +214,6 @@ resource "aws_launch_template" "webtemplate" {
key_name = var.key_name
vpc_security_group_ids = [aws_security_group.webserver.id]

network_interfaces {
associate_public_ip_address = false
}

tag_specifications {
resource_type = "instance"

Expand Down

0 comments on commit 9b46327

Please sign in to comment.