github.com/telepresenceio/telepresence/v2@v2.20.0-pro.6.0.20240517030216-236ea954e789/test-infra/aws-vpn/network.tf (about)

     1  resource "aws_vpc" "main" {
     2    cidr_block = var.vpc_cidr
     3  
     4    enable_dns_hostnames = true
     5    enable_dns_support   = true
     6    instance_tenancy     = "default"
     7  
     8    tags = local.global_tags
     9  }
    10  
    11  resource "aws_default_security_group" "default" {
    12    vpc_id = aws_vpc.main.id
    13  
    14    egress {
    15      from_port   = 0
    16      to_port     = 0
    17      protocol    = "-1"
    18      cidr_blocks = ["0.0.0.0/0"]
    19    }
    20  
    21    tags = local.global_tags
    22  }
    23  
    24  resource "aws_subnet" "sn_az" {
    25    count = length(local.availability_zones)
    26  
    27    availability_zone = local.availability_zones[count.index]
    28  
    29    vpc_id                  = aws_vpc.main.id
    30    map_public_ip_on_launch = true
    31  
    32    cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 5, count.index + 1)
    33  
    34    tags = merge(local.global_tags, { "kubernetes.io/cluster/${var.child_subdomain}-${local.prefix}cluster" : "shared" })
    35  }
    36  
    37  resource "aws_internet_gateway" "igw" {
    38    vpc_id = aws_vpc.main.id
    39  
    40    tags = local.global_tags
    41  }
    42  
    43  resource "aws_route_table" "rt" {
    44    vpc_id = aws_vpc.main.id
    45  
    46    route {
    47      cidr_block = "0.0.0.0/0"
    48      gateway_id = aws_internet_gateway.igw.id
    49    }
    50  
    51    tags = local.global_tags
    52  }
    53  
    54  resource "aws_route_table_association" "rt_assoc" {
    55    count = length(aws_subnet.sn_az)
    56  
    57    route_table_id = aws_route_table.rt.id
    58    subnet_id      = aws_subnet.sn_az[count.index].id
    59  }