Created
October 27, 2017 19:01
-
-
Save mlabouardy/66172d7f0d779d09d01991894fd5c2e1 to your computer and use it in GitHub Desktop.
Define security group for webserver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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