<commit_before>module "static" { source = "../../vars/all" }

resource "aws_vpc" "main" {
    cidr_block = "${var.vpc_cidr}"
    enable_dns_hostnames = "true"
    enable_dns_support = "true"
}

resource "aws_default_network_acl" "default" {
    default_network_acl_id = "${aws_vpc.main.default_network_acl_id}"
    egress {
        protocol = "-1"
        rule_no = 200
        action = "allow"
        cidr_block = "0.0.0.0/0"
        from_port = 0
        to_port = 0
    }
    ingress {
        protocol   = "-1"
        rule_no    = 100
        action     = "allow"
        cidr_block = "0.0.0.0/0"
        from_port  = 0
        to_port    = 0
    }
    egress {
        protocol = "-1"
        rule_no = 201
        action = "allow"
        ipv6_cidr_block = "::/0"
        from_port = 0
        to_port = 0
    }
    ingress {
        protocol   = "-1"
        rule_no    = 101
        action     = "allow"
        ipv6_cidr_block = "::/0"
        from_port  = 0
        to_port    = 0
    }
}

resource "aws_subnet" "public" {
    vpc_id = "${aws_vpc.main.id}"
    cidr_block = "${var.public_subnets[count.index]}"
    availability_zone = "${element(split(",", lookup(module.static.azs, var.aws_config["region"])), count.index)}"
    map_public_ip_on_launch = "true"
    tags {
        Name = "public${count.index}"
        Type = "public"
    }
    count = "${length(var.public_subnets)}"
}

output "id" {
    value = "${aws_vpc.main.id}"
}

output "public_subnets" {
    value = "${join(",", aws_subnet.public.*.id)}"
}<commit_msg>Add ACLs and route tables to vpc module<commit_after>module "static" { source = "../../vars/all" }

resource "aws_vpc" "main" {
    cidr_block = "${var.vpc_cidr}"
    enable_dns_hostnames = "true"
    enable_dns_support = "true"
}

resource "aws_internet_gateway" "main" {
	vpc_id = "${aws_vpc.main.id}"
}

resource "aws_default_network_acl" "default" {
    default_network_acl_id = "${aws_vpc.main.default_network_acl_id}"
    egress {
        protocol = "-1"
        rule_no = 200
        action = "allow"
        cidr_block = "0.0.0.0/0"
        from_port = 0
        to_port = 0
    }
    ingress {
        protocol   = "-1"
        rule_no    = 100
        action     = "allow"
        cidr_block = "0.0.0.0/0"
        from_port  = 0
        to_port    = 0
    }
    egress {
        protocol = "-1"
        rule_no = 201
        action = "allow"
        ipv6_cidr_block = "::/0"
        from_port = 0
        to_port = 0
    }
    ingress {
        protocol   = "-1"
        rule_no    = 101
        action     = "allow"
        ipv6_cidr_block = "::/0"
        from_port  = 0
        to_port    = 0
    }
}

resource "aws_subnet" "public" {
    vpc_id = "${aws_vpc.main.id}"
    cidr_block = "${var.public_subnets[count.index]}"
    availability_zone = "${element(split(",", lookup(module.static.azs, var.aws_config["region"])), count.index)}"
    map_public_ip_on_launch = "true"
    tags {
        Name = "public${count.index}"
        Type = "public"
    }
    count = "${length(var.public_subnets)}"
}

resource "aws_route_table" "public" {
    vpc_id = "${aws_vpc.main.id}"
    route {
        cidr_block = "0.0.0.0/0"
        gateway_id = "${aws_internet_gateway.main.id}"
    }
    route {
        ipv6_cidr_block = "::/0"
        gateway_id = "${aws_internet_gateway.main.id}"
    }
    count = "${length(var.public_subnets)}"
}

resource "aws_route_table_association" "public" {
    subnet_id = "${aws_subnet.public.*.id[count.index]}"
    route_table_id = "${aws_route_table.public.*.id[count.index]}"
    count = "${length(var.public_subnets)}"
}

output "id" {
    value = "${aws_vpc.main.id}"
}

output "public_subnets" {
    value = "${join(",", aws_subnet.public.*.id)}"
}
{'fraction_non_alphanumeric': 0.15287817938420348, 'fraction_numerical': 0.022222222222222223, 'mean_word_length': 2.1237458193979935, 'pattern_counts': {'":': 5, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 5, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3684977', 'n_tokens_mistral': 1457, 'n_tokens_neox': 1419, 'n_words': 238}