<commit_before>provider "aws" {
  version = "~> 2"
}

data "aws_region" "current" {}

locals {
  jenkins_master_internal_ip = "192.168.123.10"

  # reserved domain options: https://tools.ietf.org/html/rfc6761
  jenkins_internal_domain = "${var.env_name}.test"

  aws_default_region = "${data.aws_region.current.name}"
}

resource "aws_key_pair" "jenkins-demo" {
  key_name   = "${var.env_name}"
  public_key = "${file("../jenkins_demo/templates/id_rsa.pub")}"
}

resource "aws_vpc" "jenkins-demo" {
  cidr_block           = "192.168.0.0/16"
  enable_dns_support   = true
  enable_dns_hostnames = true

  tags {
    Name = "${var.env_name}"
  }
}

resource "aws_internet_gateway" "jenkins-demo" {
  vpc_id = "${aws_vpc.jenkins-demo.id}"

  tags {
    Name = "${var.env_name}"
  }
}

resource "aws_vpc_dhcp_options" "jenkins" {
  domain_name         = "${local.jenkins_internal_domain}"
  domain_name_servers = ["AmazonProvidedDNS"]

  tags {
    Name = "${var.env_name}"
  }
}

resource "aws_vpc_dhcp_options_association" "jenkins" {
  vpc_id          = "${aws_vpc.jenkins-demo.id}"
  dhcp_options_id = "${aws_vpc_dhcp_options.jenkins.id}"
}

resource "aws_route53_zone" "jenkins-internal" {
  name = "${local.jenkins_internal_domain}"

  vpc {
    vpc_id = "${aws_vpc.jenkins-demo.id}"
  }

  # COMMENT
  tags {
    Name = "${var.env_name}"
  }
}

resource "aws_route53_record" "jenkins-master-internal" {
  zone_id = "${aws_route53_zone.jenkins-internal.zone_id}"
  name    = "jenkins-master"
  type    = "A"
  ttl     = "30"

  records = ["${local.jenkins_master_internal_ip}"]
}

resource "aws_subnet" "jenkins-demo" {
  vpc_id                  = "${aws_vpc.jenkins-demo.id}"
  availability_zone       = "${local.aws_default_region}c"
  cidr_block              = "192.168.123.0/24"
  map_public_ip_on_launch = true

  tags {
    Name = "${var.env_name}"
  }
}

resource "aws_subnet" "jenkins_workers_c" {
  vpc_id                  = "${aws_vpc.jenkins-demo.id}"
  availability_zone       = "${local.aws_default_region}c"
  cidr_block              = "192.168.124.0/24"
  map_public_ip_on_launch = true

  tags {
    Name = "${var.env_name}"
  }
}

resource "aws_subnet" "jenkins_workers_d" {
  vpc_id                  = "${aws_vpc.jenkins-demo.id}"
  availability_zone       = "${local.aws_default_region}d"
  cidr_block              = "192.168.125.0/24"
  map_public_ip_on_launch = true

  tags {
    Name = "${var.env_name}"
  }
}

resource "aws_route_table" "jenkins-demo" {
  vpc_id = "${aws_vpc.jenkins-demo.id}"

  route {
    cidr_block = "0.0.0.0/0"
    gateway_id = "${aws_internet_gateway.jenkins-demo.id}"
  }

  tags {
    Name = "${var.env_name}"
  }
}

resource "aws_main_route_table_association" "jenkins-demo" {
  vpc_id         = "${aws_vpc.jenkins-demo.id}"
  route_table_id = "${aws_route_table.jenkins-demo.id}"
}

resource "aws_network_acl" "jenkins-demo" {
  vpc_id = "${aws_vpc.jenkins-demo.id}"
<commit_msg>do not remove eks generated tags from vpc/subnets<commit_after>provider "aws" {
  version = "~> 2"
}

data "aws_region" "current" {}

locals {
  jenkins_master_internal_ip = "192.168.123.10"

  # reserved domain options: https://tools.ietf.org/html/rfc6761
  jenkins_internal_domain = "${var.env_name}.test"

  aws_default_region = "${data.aws_region.current.name}"
}

resource "aws_key_pair" "jenkins-demo" {
  key_name   = "${var.env_name}"
  public_key = "${file("../jenkins_demo/templates/id_rsa.pub")}"
}

resource "aws_vpc" "jenkins-demo" {
  cidr_block           = "192.168.0.0/16"
  enable_dns_support   = true
  enable_dns_hostnames = true

  tags {
    Name = "${var.env_name}"
  }

  lifecycle {
    ignore_changes = [
      # eks created tags
      "tags",
    ]
  }
}

resource "aws_internet_gateway" "jenkins-demo" {
  vpc_id = "${aws_vpc.jenkins-demo.id}"

  tags {
    Name = "${var.env_name}"
  }
}

resource "aws_vpc_dhcp_options" "jenkins" {
  domain_name         = "${local.jenkins_internal_domain}"
  domain_name_servers = ["AmazonProvidedDNS"]

  tags {
    Name = "${var.env_name}"
  }
}

resource "aws_vpc_dhcp_options_association" "jenkins" {
  vpc_id          = "${aws_vpc.jenkins-demo.id}"
  dhcp_options_id = "${aws_vpc_dhcp_options.jenkins.id}"
}

resource "aws_route53_zone" "jenkins-internal" {
  name = "${local.jenkins_internal_domain}"

  vpc {
    vpc_id = "${aws_vpc.jenkins-demo.id}"
  }

  # COMMENT
  tags {
    Name = "${var.env_name}"
  }
}

resource "aws_route53_record" "jenkins-master-internal" {
  zone_id = "${aws_route53_zone.jenkins-internal.zone_id}"
  name    = "jenkins-master"
  type    = "A"
  ttl     = "30"

  records = ["${local.jenkins_master_internal_ip}"]
}

resource "aws_subnet" "jenkins-demo" {
  vpc_id                  = "${aws_vpc.jenkins-demo.id}"
  availability_zone       = "${local.aws_default_region}c"
  cidr_block              = "192.168.123.0/24"
  map_public_ip_on_launch = true

  tags {
    Name = "${var.env_name}"
  }

  lifecycle {
    ignore_changes = [
      # eks created tags
      "tags",
    ]
  }
}

resource "aws_subnet" "jenkins_workers_c" {
  vpc_id                  = "${aws_vpc.jenkins-demo.id}"
  availability_zone       = "${local.aws_default_region}c"
  cidr_block              = "192.168.124.0/24"
  map_public_ip_on_launch = true

  tags {
    Name = "${var.env_name}"
  }

  lifecycle {
    ignore_changes = [
      # eks created tags
      "tags",
    ]
  }
}

resource "aws_subnet" "jenkins_workers_d" {
  vpc_id                  = "${aws_vpc.jenkins-demo.id}"
  availability_zone       = "${local.aws_default_region}d"
  cidr_block              = "192.168.125.0/24"
  map_public_ip_on_launch = true

  tags {
    Name = "${var.env_name}"
  }

  lifecycle {
    ignore_changes = [
      # eks created tags
      "tags",
    ]
  }
}

resource "aws_route_table" "jenkins-demo" {
  vpc_id = "${aws_vpc.jenkins-demo.id}"

  route {
    cidr_block = "0.0.0.0/0"
    gateway_id = "${aws_internet_gateway.jenkins-demo.id}"
  }

  tags {
    Name = "${var.env_name}"
  }
}

resource "aws_main_route_table_association" "jenkins-demo" {
  vpc_id         = "${aws_vpc.jenkins-demo.id}"
  route_table_id = "${aws_route_table.jenkins-demo.id}"
}

resource "aws_network_acl" "jenkins-demo" {
  vpc_id = "${aws_vpc.jenkins-demo.id}"

{'fraction_non_alphanumeric': 0.1512, 'fraction_numerical': 0.024, 'mean_word_length': 2.999360204734485, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 12, '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': '7335196', 'n_tokens_mistral': 2610, 'n_tokens_neox': 2478, 'n_words': 339}