<commit_before># Variables 

variable "ami" {
  type        = "string"
  description = "AMI to use for deploying Consul. Use one based on Ubuntu Trusty."
}

variable "instance_type" {
  type        = "string"
  description = "AWS instance type for Consul servers."
}

variable "key_path" {
  type        = "string"
  description = "Path to SSH key used for configuring instances"
}

variable "key_name" {
  type        = "string"
  description = "Name of SSH key to insert into machine to grant initial access"
}

variable "num_instances" {
  type        = "string"
  description = "Number of consul servers to deploy. Consul advides using odd numbers to avoid stalemate elections."
  default     = "3"
}

variable "prefix" {
  type        = "string"
  description = "Prefix for naming instances"
  default     = "consul-"
}

variable "region" {
  type        = "string"
  description = "AWS region for deploying Consul nodes"
}

variable "vpc" {
  type        = "string"
  description = "VPC in which to deploy Consul"
}

#######################################
provider "aws" {
  region = "${var.region}"
}

resource "aws_security_group" "consul" {
  name_prefix = "${var.prefix}"
  description = "Allow consul traffic"
  vpc_id      = "${var.vpc}"
}

resource "aws_security_group_rule" "ssh" {
  type              = "ingress"
  from_port         = 22
  to_port           = 22
  protocol          = "tcp"
  security_group_id = "${aws_security_group.consul.id}"
  self = true
}

resource "aws_security_group_rule" "consul_rpc" {
  type              = "ingress"
  from_port         = "8300"
  to_port           = "8300"
  protocol          = "tcp"
  security_group_id = "${aws_security_group.consul.id}"
  self = true
}

resource "aws_security_group_rule" "consul_serf_lan" {
  type              = "ingress"
  from_port         = "8301"
  to_port           = "8301"
  protocol          = "all"
  security_group_id = "${aws_security_group.consul.id}"
  self = true
}

resource "aws_security_group_rule" "consul_serf_wan" {
  type              = "ingress"
  from_port         = "8302"
  to_port           = "8302"
  protocol          = "all"
  security_group_id = "${aws_security_group.consul.id}"
  self = true
}

resource "aws_security_group_rule" "consul_cli_rpc" {
  type              = "ingress"
  from_port         = "8400"
  to_port           = "8400"
  protocol          = "tcp"
  security_group_id = "${aws_security_group.consul.id}"
  self = true
}

resource "aws_security_group_rule" "consul_http_api" {
  type              = "ingress"
  from_port         = "8500"
  to_port           = "8500"
  protocol          = "tcp"
  security_group_id = "${aws_security_group.consul.id}"
  cidr_blocks       = ['0.0.0.0/0']
}
<commit_msg>Apparently TF hates single quotes.<commit_after># Variables 

variable "ami" {
  type        = "string"
  description = "AMI to use for deploying Consul. Use one based on Ubuntu Trusty."
}

variable "instance_type" {
  type        = "string"
  description = "AWS instance type for Consul servers."
}

variable "key_path" {
  type        = "string"
  description = "Path to SSH key used for configuring instances"
}

variable "key_name" {
  type        = "string"
  description = "Name of SSH key to insert into machine to grant initial access"
}

variable "num_instances" {
  type        = "string"
  description = "Number of consul servers to deploy. Consul advides using odd numbers to avoid stalemate elections."
  default     = "3"
}

variable "prefix" {
  type        = "string"
  description = "Prefix for naming instances"
  default     = "consul-"
}

variable "region" {
  type        = "string"
  description = "AWS region for deploying Consul nodes"
}

variable "vpc" {
  type        = "string"
  description = "VPC in which to deploy Consul"
}

#######################################
provider "aws" {
  region = "${var.region}"
}

resource "aws_security_group" "consul" {
  name_prefix = "${var.prefix}"
  description = "Allow consul traffic"
  vpc_id      = "${var.vpc}"
}

resource "aws_security_group_rule" "ssh" {
  type              = "ingress"
  from_port         = 22
  to_port           = 22
  protocol          = "tcp"
  security_group_id = "${aws_security_group.consul.id}"
  self = true
}

resource "aws_security_group_rule" "consul_rpc" {
  type              = "ingress"
  from_port         = "8300"
  to_port           = "8300"
  protocol          = "tcp"
  security_group_id = "${aws_security_group.consul.id}"
  self = true
}

resource "aws_security_group_rule" "consul_serf_lan" {
  type              = "ingress"
  from_port         = "8301"
  to_port           = "8301"
  protocol          = "all"
  security_group_id = "${aws_security_group.consul.id}"
  self = true
}

resource "aws_security_group_rule" "consul_serf_wan" {
  type              = "ingress"
  from_port         = "8302"
  to_port           = "8302"
  protocol          = "all"
  security_group_id = "${aws_security_group.consul.id}"
  self = true
}

resource "aws_security_group_rule" "consul_cli_rpc" {
  type              = "ingress"
  from_port         = "8400"
  to_port           = "8400"
  protocol          = "tcp"
  security_group_id = "${aws_security_group.consul.id}"
  self = true
}

resource "aws_security_group_rule" "consul_http_api" {
  type              = "ingress"
  from_port         = "8500"
  to_port           = "8500"
  protocol          = "tcp"
  security_group_id = "${aws_security_group.consul.id}"
  cidr_blocks       = ["0.0.0.0/0"]
}

{'fraction_non_alphanumeric': 0.12211101000909919, 'fraction_numerical': 0.018198362147406732, 'mean_word_length': 2.491740787801779, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '1024869', 'n_tokens_mistral': 1899, 'n_tokens_neox': 1820, 'n_words': 444}