mirror of
https://github.com/Sea-Haven-Industries/afterhours-shift-manager.git
synced 2026-09-30 06:43:12 +00:00
PutRolePolicy cannot add a third inline on the prod apply role; CreatePolicy of /tf-managed/afterhours-shift-manager-ecs still needs the bootstrap window.
61 lines
1.4 KiB
HCL
61 lines
1.4 KiB
HCL
data "aws_availability_zones" "available" {
|
|
state = "available"
|
|
}
|
|
|
|
resource "aws_vpc" "this" {
|
|
cidr_block = local.vpc_cidr
|
|
enable_dns_support = true
|
|
enable_dns_hostnames = true
|
|
|
|
tags = {
|
|
Name = "${local.project}-vpc"
|
|
}
|
|
|
|
# First apply updates the live hcptf apply role before CreateVpc.
|
|
depends_on = [
|
|
aws_iam_role_policy.hcptf_apply_services,
|
|
aws_iam_role_policy_attachments_exclusive.hcptf_apply,
|
|
]
|
|
}
|
|
|
|
resource "aws_internet_gateway" "this" {
|
|
vpc_id = aws_vpc.this.id
|
|
|
|
tags = {
|
|
Name = "${local.project}-igw"
|
|
}
|
|
}
|
|
|
|
resource "aws_subnet" "public" {
|
|
count = length(local.public_subnet_cidrs)
|
|
|
|
vpc_id = aws_vpc.this.id
|
|
cidr_block = local.public_subnet_cidrs[count.index]
|
|
availability_zone = data.aws_availability_zones.available.names[count.index]
|
|
map_public_ip_on_launch = true
|
|
|
|
tags = {
|
|
Name = "${local.project}-public-${count.index}"
|
|
}
|
|
}
|
|
|
|
resource "aws_route_table" "public" {
|
|
vpc_id = aws_vpc.this.id
|
|
|
|
tags = {
|
|
Name = "${local.project}-public"
|
|
}
|
|
}
|
|
|
|
resource "aws_route" "public_default" {
|
|
route_table_id = aws_route_table.public.id
|
|
destination_cidr_block = "0.0.0.0/0"
|
|
gateway_id = aws_internet_gateway.this.id
|
|
}
|
|
|
|
resource "aws_route_table_association" "public" {
|
|
count = length(local.public_subnet_cidrs)
|
|
|
|
subnet_id = aws_subnet.public[count.index].id
|
|
route_table_id = aws_route_table.public.id
|
|
}
|