Created
April 12, 2019 18:40
-
-
Save crizstian/a964ec87e4052ba6b9a6897f64ba6777 to your computer and use it in GitHub Desktop.
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
resource "aws_subnet" "bastion_private_subnet" { | |
cidr_block = "${var.bastion_private_cidr}" | |
availability_zone = "${var.available_zone}" | |
vpc_id = "${aws_vpc.bastion_vpc.id}" | |
tags { | |
Application = "${var.bastion_cluster_name}" | |
Environment = "${terraform.workspace}" | |
Name = "${var.bastion_cluster_name}-private-subnet" | |
} | |
} | |
resource "aws_subnet" "bastion_public_subnet" { | |
cidr_block = "${var.bastion_public_cidr}" | |
availability_zone = "${var.available_zone}" | |
vpc_id = "${aws_vpc.bastion_vpc.id}" | |
tags { | |
Application = "${var.bastion_cluster_name}" | |
Environment = "${terraform.workspace}" | |
Name = "${var.bastion_cluster_name}-public-subnet" | |
} | |
} | |
resource "aws_route_table" "public_route_table" { | |
vpc_id = "${aws_vpc.bastion_vpc.id}" | |
tags { | |
Application = "${var.bastion_cluster_name}" | |
Environment = "${terraform.workspace}" | |
Name = "${var.bastion_cluster_name}-public-route-table" | |
} | |
} | |
resource "aws_route_table_association" "associate_public_subnet" { | |
route_table_id = "${aws_route_table.public_route_table.id}" | |
subnet_id = "${aws_subnet.bastion_public_subnet.id}" | |
} | |
resource "aws_route" "route_to_internet" { | |
destination_cidr_block = "0.0.0.0/0" | |
gateway_id = "${aws_internet_gateway.bastion_gw.id}" | |
route_table_id = "${aws_route_table.public_route_table.id}" | |
} | |
resource "aws_route_table" "private_route_table" { | |
vpc_id = "${aws_vpc.bastion_vpc.id}" | |
tags { | |
Application = "${var.bastion_cluster_name}" | |
Environment = "${terraform.workspace}" | |
Name = "${var.bastion_cluster_name}-private-route-table" | |
} | |
} | |
resource "aws_route_table_association" "associate_private_subnet" { | |
route_table_id = "${aws_route_table.private_route_table.id}" | |
subnet_id = "${aws_subnet.bastion_private_subnet.id}" | |
} | |
resource "aws_route" "route_to_nat" { | |
destination_cidr_block = "0.0.0.0/0" | |
nat_gateway_id = "${aws_nat_gateway.nat_gateway.id}" | |
route_table_id = "${aws_route_table.private_route_table.id}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment