Created
April 13, 2015 08:02
-
-
Save bensojona/9cb180ab4f6e8ddf761d to your computer and use it in GitHub Desktop.
Consule module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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