96 lines
1.9 KiB
HCL
96 lines
1.9 KiB
HCL
resource "aws_vpc" "main" {
|
|
cidr_block = "10.0.0.0/16"
|
|
enable_dns_hostnames = "True"
|
|
}
|
|
|
|
resource "aws_subnet" "public_subnet_1" {
|
|
vpc_id = "${aws_vpc.main.id}"
|
|
availability_zone = "us-east-1a"
|
|
cidr_block = "10.0.1.0/26"
|
|
}
|
|
|
|
resource "aws_internet_gateway" "main_gw" {
|
|
vpc_id = "${aws_vpc.main.id}"
|
|
}
|
|
|
|
resource "aws_route_table" "main_route_table" {
|
|
vpc_id = "${aws_vpc.main.id}"
|
|
route {
|
|
cidr_block = "0.0.0.0/0"
|
|
gateway_id = "${aws_internet_gateway.main_gw.id}"
|
|
}
|
|
}
|
|
|
|
resource "aws_route_table_association" "route_subnet_1" {
|
|
subnet_id = "${aws_subnet.public_subnet_1.id}"
|
|
route_table_id = "${aws_route_table.main_route_table.id}"
|
|
}
|
|
|
|
resource "aws_security_group" "main_sg" {
|
|
vpc_id = "${aws_vpc.main.id}"
|
|
|
|
ingress {
|
|
from_port = 22
|
|
to_port = 22
|
|
protocol = "tcp"
|
|
cidr_blocks = ["0.0.0.0/0"]
|
|
}
|
|
|
|
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"]
|
|
}
|
|
|
|
# SMTP
|
|
ingress {
|
|
from_port = 25
|
|
to_port = 25
|
|
protocol = "tcp"
|
|
cidr_blocks = ["0.0.0.0/0"]
|
|
}
|
|
|
|
ingress {
|
|
from_port = 587
|
|
to_port = 587
|
|
protocol = "tcp"
|
|
cidr_blocks = ["0.0.0.0/0"]
|
|
}
|
|
|
|
ingress {
|
|
from_port = 993
|
|
to_port = 993
|
|
protocol = "tcp"
|
|
cidr_blocks = ["0.0.0.0/0"]
|
|
}
|
|
|
|
ingress {
|
|
from_port = 4190
|
|
to_port = 4190
|
|
protocol = "tcp"
|
|
cidr_blocks = ["0.0.0.0/0"]
|
|
}
|
|
|
|
ingress {
|
|
from_port = 53
|
|
to_port = 53
|
|
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"]
|
|
}
|
|
}
|