Skip to content

Instantly share code, notes, and snippets.

@bensojona
Created April 13, 2015 08:02
Show Gist options
  • Save bensojona/9cb180ab4f6e8ddf761d to your computer and use it in GitHub Desktop.
Save bensojona/9cb180ab4f6e8ddf761d to your computer and use it in GitHub Desktop.
Consule module
resource "aws_instance" "consul" {
ami = "${var.ami}"
security_groups = ["${var.security_group}"]
key_name = "${var.key_name}"
instance_type = "${var.instance_type}"
availability_zone = "${var.availability_zone}"
count = "${var.count}"
tags {
Name = "consul_${count.index+1}"
}
provisioner "remote-exec" {
inline = [
"sudo sed -i -- 's/{{ atlas_username }}/${var.atlas_username}/g' /etc/init/consul.conf",
"sudo sed -i -- 's/{{ atlas_token }}/${var.atlas_token}/g' /etc/init/consul.conf",
"sudo sed -i -- 's/{{ atlas_environment }}/${var.atlas_environment}/g' /etc/init/consul.conf",
"sudo sed -i -- 's/{{ count }}/${var.count}/g' /etc/init/consul.conf",
"sudo service consul restart"
]
connection {
user = "${var.user}"
key_file = "${var.key_file}"
agent = "${var.agent}"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment