<commit_before>provider "aws" {
  access_key = "${var.aws_key}"
  secret_key = "${var.aws_secret}"
  region = "${var.aws_region}"
}

resource "coreosbox_ami" "coreos_ami" {
  channel        = "${var.coreos_channel}"
  virtualization = "hvm"
  region         = "${var.aws_region}"
  version        = "${var.coreos_version}"
}

resource "template_file" "cloudconfig" {
  template = "templates/cloud-config.tpl"

  vars {
    hostname = "${var.ci_hostname}"
    jenkins_ssh_key = "${var.jenkins_ssh_key}"
  }
}

resource "template_file" "ansible_inventory" {
  template = "${path.module}/templates/inventory.remote.tpl"

  vars {
    public_ip = "${aws_instance.jenkins_ec2.public_ip}"
    private_jenkins_ssh_key = "${var.private_jenkins_ssh_key}"
  }

  provisioner "local-exec" {
    command = "cat << 'EOF' > ${path.module}/../ansible/inventory.remote\n${self.rendered}\nEOF"
  }
}

resource "aws_vpc" "jenkins_vpc" {
  cidr_block           = "10.0.0.0/16"
  instance_tenancy     = "default"
  enable_dns_support   = true
  enable_dns_hostnames = false

  tags {
    Name = "${var.ci_hostname}_vpc"
  }
}

resource "aws_vpc_dhcp_options" "jenkins_vpc_dhcp" {
  domain_name         = "${var.aws_region}.compute.internal"
  domain_name_servers = ["AmazonProvidedDNS"]

  tags {
    Name = "${var.ci_hostname}_dhcp"
  }
}

resource "aws_vpc_dhcp_options_association" "jenkins_vpc_dhcp_association" {
  vpc_id          = "${aws_vpc.jenkins_vpc.id}"
  dhcp_options_id = "${aws_vpc_dhcp_options.jenkins_vpc_dhcp.id}"
}

resource "aws_internet_gateway" "jenkins_vpc_gateway" {
  vpc_id = "${aws_vpc.jenkins_vpc.id}"

  tags {
    Name = "${var.ci_hostname}_gateway"
  }
}

resource "aws_route_table" "jenkins_vpc_rt" {
  vpc_id = "${aws_vpc.jenkins_vpc.id}"

  route {
    cidr_block = "0.0.0.0/0"
    gateway_id = "${aws_internet_gateway.jenkins_vpc_gateway.id}"
  }

  tags {
    Name = "{var.ci_hostname}_rt"
  }
}

resource "aws_security_group" "jenkins_secgroup" {
  name = "${var.aws_secgroup_name}"
  description = "Security group for ${var.ci_hostname} Jenkins server"
  vpc_id = "${aws_vpc.jenkins_vpc.id}"

  ingress {
    from_port = 22
    to_port = 22
    protocol = "TCP"
    cidr_blocks = ["0.0.0.0/0"]
  }

  ingress {
    from_port = 80
    to_port = 80
    protocol = "TCP"
    cidr_blocks = ["0.0.0.0/0"]
  }

  ingress {
    from_port = 443
    to_port = 443
    protocol = "TCP"
    cidr_blocks = ["0.0.0.0/0"]
  }

  egress {
    from_port = 0
    to_port = 0
    protocol = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }

  tags {
    Name = "${var.ci_hostname} security group"
  }
}

resource "aws_key_pair" "jenkins_keypair" {
  key_name = "${var.aws_key_name}"
  public_key = "${file(var.jenkins_ssh_key)}"
}

resource "aws_subnet" "jenkins_subnet" {
  vpc_id = "${aws_vpc.jenkins_vpc.id}"
  cidr_block = "10.0.0.0/22"

  tags {
      Name = "${var.ci_hostname} subnet"
  }
}

resource "aws_instance" "jenkins_ec2" {
  depends_on = ["template_file.cloudconfig", "template_file.cloudconfig"]
  ami = "${coreosbox_ami.coreos_ami.box_string}"
  instance_type = "${var.aws_instance_type}"
  key_name = "${aws_key_pair.jenkins_keypair.key_name}"
  vpc_security_group_ids = [ "${aws_security_group.jenkins_secgroup.id}" ]
  subnet_id = "${aws_subnet.jenkins_subnet.id}"
  associate_public_ip_address = true
  ebs_block_device {
    device_name = "/dev/sdf"
    volume_size = "${var.aws_ebs_size}"
  }
  user_data = "${template_file.cloudconfig.rendered}"
  tags {
    Name = "${var.ci_hostname}"
  }
}

resource "aws_route53_record" "pipelet_route" {
  depends_on = ["aws_instance.jenkins_ec2", "template_file.ansible_inventory"]
  zone_id = "${var.route53_zone_id}"
  name = "${var.ci_hostname}"
  type = "A"
  ttl = "30"
  records = ["${aws_instance.jenkins_ec2.public_ip}"]
}<commit_msg>more missing resources<commit_after>provider "aws" {
  access_key = "${var.aws_key}"
  secret_key = "${var.aws_secret}"
  region = "${var.aws_region}"
}

resource "coreosbox_ami" "coreos_ami" {
  channel        = "${var.coreos_channel}"
  virtualization = "hvm"
  region         = "${var.aws_region}"
  version        = "${var.coreos_version}"
}

resource "template_file" "cloudconfig" {
  template = "templates/cloud-config.tpl"

  vars {
    hostname = "${var.ci_hostname}"
    jenkins_ssh_key = "${var.jenkins_ssh_key}"
  }
}

resource "template_file" "ansible_inventory" {
  template = "${path.module}/templates/inventory.remote.tpl"

  vars {
    public_ip = "${aws_instance.jenkins_ec2.public_ip}"
    private_jenkins_ssh_key = "${var.private_jenkins_ssh_key}"
  }

  provisioner "local-exec" {
    command = "cat << 'EOF' > ${path.module}/../ansible/inventory.remote\n${self.rendered}\nEOF"
  }
}

resource "aws_vpc" "jenkins_vpc" {
  cidr_block           = "10.0.0.0/16"
  instance_tenancy     = "default"
  enable_dns_support   = true
  enable_dns_hostnames = false

  tags {
    Name = "${var.ci_hostname}_vpc"
  }
}

resource "aws_vpc_dhcp_options" "jenkins_vpc_dhcp" {
  domain_name         = "${var.aws_region}.compute.internal"
  domain_name_servers = ["AmazonProvidedDNS"]

  tags {
    Name = "${var.ci_hostname}_dhcp"
  }
}

resource "aws_vpc_dhcp_options_association" "jenkins_vpc_dhcp_association" {
  vpc_id          = "${aws_vpc.jenkins_vpc.id}"
  dhcp_options_id = "${aws_vpc_dhcp_options.jenkins_vpc_dhcp.id}"
}

resource "aws_internet_gateway" "jenkins_vpc_gateway" {
  vpc_id = "${aws_vpc.jenkins_vpc.id}"

  tags {
    Name = "${var.ci_hostname}_gateway"
  }
}

resource "aws_route_table" "jenkins_vpc_rt" {
  vpc_id = "${aws_vpc.jenkins_vpc.id}"

  route {
    cidr_block = "0.0.0.0/0"
    gateway_id = "${aws_internet_gateway.jenkins_vpc_gateway.id}"
  }

  tags {
    Name = "${var.ci_hostname}_rt"
  }
}

resource "aws_network_acl" "jenkins_vpc_acl" {
  vpc_id = "${aws_vpc.jenkins_vpc.id}"

  egress {
    protocol   = "-1"
    rule_no    = 100
    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
  }

  tags {
    Name = "${var.ci_hostname}_acl"
  }
}

resource "aws_key_pair" "jenkins_keypair" {
  key_name = "${var.aws_key_name}"
  public_key = "${file(var.jenkins_ssh_key)}"
}

resource "aws_subnet" "jenkins_subnet" {
  vpc_id = "${aws_vpc.jenkins_vpc.id}"
  cidr_block = "10.0.0.0/22"
  map_public_ip_on_launch = true

  tags {
      Name = "${var.ci_hostname} subnet"
  }
}

resource "aws_route_table_association" "jenkins_subnet_rt_association" {
  subnet_id      = "${aws_subnet.jenkins_subnet.id}"
  route_table_id = "${aws_route_table.jenkins_vpc_rt.id}"
}

resource "aws_security_group" "jenkins_secgroup" {
  name = "${var.aws_secgroup_name}"
  description = "Security group for ${var.ci_hostname} Jenkins server"
  vpc_id = "${aws_vpc.jenkins_vpc.id}"

  ingress {
    from_port = 22
    to_port = 22
    protocol = "TCP"
    cidr_blocks = ["0.0.0.0/0"]
  }

  ingress {
    from_port = 80
    to_port = 80
    protocol = "TCP"
    cidr_blocks = ["0.0.0.0/0"]
  }

  ingress {
    from_port = 443
    to_port = 443
    protocol = "TCP"
    cidr_blocks = ["0.0.0.0/0"]
  }

  egress {
    from_port = 0
    to_port = 0
    protocol = "-1"
    cidr_blocks = ["0.0.0.0/0"]
  }

  tags {
    Name = "${var.ci_hostname} security group"
  }
}

resource "aws_instance" "jenkins_ec2" {
  depends_on = ["template_file.cloudconfig", "template_file.cloudconfig"]
  ami = "${coreosbox_ami.coreos_ami.box_string}"
  instance_type = "${var.aws_instance_type}"
  key_name = "${aws_key_pair.jenkins_keypair.key_name}"
  vpc_security_group_ids = [ "${aws_security_group.jenkins_secgroup.id}" ]
  subnet_id = "${aws_subnet.jenkins_subnet.id}"
  associate_public_ip_address = true
  ebs_block_device {
    device_name = "/dev/sdf"
    volume_size = "${var.aws_ebs_size}"
  }
  user_data = "${template_file.cloudconfig.rendered}"
  tags {
    Name = "${var.ci_hostname}"
  }
}

resource "aws_route53_record" "pipelet_route" {
  depends_on = ["aws_instance.jenkins_ec2", "template_file.ansible_inventory"]
  zone_id = "${var.route53_zone_id}"
  name = "${var.ci_hostname}"
  type = "A"
  ttl = "30"
  records = ["${aws_instance.jenkins_ec2.public_ip}"]
}
{'fraction_non_alphanumeric': 0.15009675858732463, 'fraction_numerical': 0.018626028059990325, 'mean_word_length': 3.5284775465498357, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 16, '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': '74519', 'n_tokens_mistral': 3452, 'n_tokens_neox': 3369, 'n_words': 473}