<commit_before>module "master_amitype" {
  source        = "github.com/terraform-community-modules/tf_aws_virttype"
  instance_type = "${var.master_instance_type}"
}

module "master_ami" {
  source   = "github.com/terraform-community-modules/tf_aws_coreos_ami"
  region   = "${var.region}"
  channel  = "${var.coreos_channel}"
  virttype = "${module.master_amitype.prefer_hvm}"
}

resource "template_file" "master_cloud_init" {
  template   = "${file("master-cloud-config.yml.tpl")}"
  depends_on = ["template_file.etcd_discovery_url"]
  vars {
    etcd_discovery_url = "${file(var.etcd_discovery_url_file)}"
    size               = "${var.masters}"
    region             = "${var.region}"
    etcd_ca            = "${replace(module.ca.ca_cert_pem, \"\n\", \"\\n\")}"
    etcd_cert          = "${replace(module.etcd_cert.etcd_cert_pem, \"\n\", \"\\n\")}"
    etcd_key           = "${replace(module.etcd_cert.etcd_private_key, \"\n\", \"\\n\")}"
  }
}

resource "aws_instance" "master" {
  instance_type        = "${var.master_instance_type}"
  ami                  = "${module.master_ami.ami_id}"
  iam_instance_profile = "${module.iam.master_profile_name}"
  count                = "${var.masters}"
  key_name             = "${module.aws-keypair.keypair_name}"
  subnet_id            = "${element(split(",", module.public_subnet.subnet_ids), count.index)}"
  source_dest_check    = false
  security_groups      = ["${module.sg-default.security_group_id}"]
  user_data            = "${template_file.master_cloud_init.rendered}"
  tags = {
    Name   = "kube-master-${count.index}"
    role   = "masters"
    region = "${var.region}"
  }
  connection {
    user                = "core"
    private_key         = "${tls_private_key.ssh.private_key_pem}"
  }
  provisioner "file" {
    source      = "../../scripts/coreos"
    destination = "/tmp"
  }
  provisioner "remote-exec" {
    inline = [
      "sudo chmod -R +x /tmp/coreos",
      "/tmp/coreos/bootstrap.sh",
      "~/bin/python /tmp/coreos/get-pip.py",
      "sudo mv /tmp/coreos/runner ~/bin/pip && sudo chmod 0755 ~/bin/pip",
      "sudo rm -rf /tmp/coreos"
    ]
  }
}

module "master_elb" {
  source             = "../elb"
  security_groups    = "${module.sg-default.security_group_id}"
  instances          = "${compact(aws_instance.master.*.id)}"
  subnets            = "${compact(aws_instance.master.*.subnet_id)}"
}

output "master_ips" {
  value = "${join(",", aws_instance.master.*.public_ip)}"
}
output "master_elb_hostname" {
  value = "${module.master_elb.elb_dns_name}"
}<commit_msg>Fix terraform diff error. (#117)<commit_after>module "master_amitype" {
  source        = "github.com/terraform-community-modules/tf_aws_virttype"
  instance_type = "${var.master_instance_type}"
}

module "master_ami" {
  source   = "github.com/terraform-community-modules/tf_aws_coreos_ami"
  region   = "${var.region}"
  channel  = "${var.coreos_channel}"
  virttype = "${module.master_amitype.prefer_hvm}"
}

resource "template_file" "master_cloud_init" {
  template   = "${file("master-cloud-config.yml.tpl")}"
  depends_on = ["template_file.etcd_discovery_url"]
  vars {
    etcd_discovery_url = "${file(var.etcd_discovery_url_file)}"
    size               = "${var.masters}"
    region             = "${var.region}"
    etcd_ca            = "${replace(module.ca.ca_cert_pem, \"\n\", \"\\n\")}"
    etcd_cert          = "${replace(module.etcd_cert.etcd_cert_pem, \"\n\", \"\\n\")}"
    etcd_key           = "${replace(module.etcd_cert.etcd_private_key, \"\n\", \"\\n\")}"
  }
}

resource "aws_instance" "master" {
  instance_type        = "${var.master_instance_type}"
  ami                  = "${module.master_ami.ami_id}"
  iam_instance_profile = "${module.iam.master_profile_name}"
  count                = "${var.masters}"
  key_name             = "${module.aws-keypair.keypair_name}"
  subnet_id            = "${element(split(",", module.public_subnet.subnet_ids), count.index)}"
  source_dest_check    = false
  security_groups      = ["${module.sg-default.security_group_id}"]
  user_data            = "${template_file.master_cloud_init.rendered}"
  tags = {
    Name   = "kube-master-${count.index}"
    role   = "masters"
    region = "${var.region}"
  }
  connection {
    user                = "core"
    private_key         = "${tls_private_key.ssh.private_key_pem}"
  }
  provisioner "file" {
    source      = "../../scripts/coreos"
    destination = "/tmp"
  }
  provisioner "remote-exec" {
    inline = [
      "sudo chmod -R +x /tmp/coreos",
      "/tmp/coreos/bootstrap.sh",
      "~/bin/python /tmp/coreos/get-pip.py",
      "sudo mv /tmp/coreos/runner ~/bin/pip && sudo chmod 0755 ~/bin/pip",
      "sudo rm -rf /tmp/coreos"
    ]
  }
}

module "master_elb" {
  source             = "../elb"
  security_groups    = "${module.sg-default.security_group_id}"
  instances          = "${compact(aws_instance.master.*.id)}"
  subnets            = "${compact(split(",", module.public_subnet.subnet_ids))}"
}

output "master_ips" {
  value = "${join(",", aws_instance.master.*.public_ip)}"
}
output "master_elb_hostname" {
  value = "${module.master_elb.elb_dns_name}"
}
{'fraction_non_alphanumeric': 0.17220602526724976, 'fraction_numerical': 0.002137998056365403, 'mean_word_length': 2.707492795389049, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '6799724', 'n_tokens_mistral': 1861, 'n_tokens_neox': 1819, 'n_words': 255}