Created
June 12, 2020 15:14
-
-
Save iamtheindian/cb26d74cd688153e52c7161530c94556 to your computer and use it in GitHub Desktop.
This file contains 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
#creation of security group | |
resource "aws_default_vpc" "main" { | |
tags = { | |
Name = "Default VPC" | |
} | |
} | |
resource "aws_security_group" "allow_tls" { | |
name = "allow_tls" | |
description = "Allow TLS inbound traffic" | |
vpc_id = aws_default_vpc.main.id | |
ingress { | |
description = "SSH CONFIG" | |
from_port = 22 | |
to_port = 22 | |
protocol = "tcp" | |
cidr_blocks = ["0.0.0.0/0"] | |
} | |
egress { | |
from_port = 0 | |
to_port = 0 | |
protocol = "-1" | |
cidr_blocks = ["0.0.0.0/0"] | |
} | |
tags = { | |
Name = "allow_tls" | |
} | |
} | |
resource "aws_security_group_rule" "http" { | |
type = "ingress" | |
from_port = 80 | |
to_port = 80 | |
protocol = "tcp" | |
cidr_blocks = ["0.0.0.0/0"] | |
security_group_id = aws_security_group.allow_tls.id | |
description = "HTTP CONFIG" | |
} | |
resource "aws_security_group_rule" "https" { | |
type = "ingress" | |
from_port = 443 | |
to_port = 443 | |
protocol = "tcp" | |
cidr_blocks = ["0.0.0.0/0"] | |
security_group_id = aws_security_group.allow_tls.id | |
description = "HTTPS CONFIG" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment