Skip to content

Instantly share code, notes, and snippets.

@bensojona
Created April 13, 2015 08:01
Show Gist options
  • Save bensojona/2371b679f111c46e74d1 to your computer and use it in GitHub Desktop.
Save bensojona/2371b679f111c46e74d1 to your computer and use it in GitHub Desktop.
Metamon module
resource "aws_instance" "metamon" {
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 = "metamon_${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 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