Skip to content

Instantly share code, notes, and snippets.

@mlabouardy
Created October 27, 2017 19:01
Show Gist options
  • Save mlabouardy/66172d7f0d779d09d01991894fd5c2e1 to your computer and use it in GitHub Desktop.
Save mlabouardy/66172d7f0d779d09d01991894fd5c2e1 to your computer and use it in GitHub Desktop.
Define security group for webserver
# Define the security group for public subnet
resource "aws_security_group" "sgweb" {
name = "vpc_test_web"
description = "Allow incoming HTTP connections & SSH access"
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = -1
to_port = -1
protocol = "icmp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
vpc_id="${aws_vpc.default.id}"
tags {
Name = "Web Server SG"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment