Skip to content

Commit

Permalink
Merge pull request #16 from mengesb/multi_az
Browse files Browse the repository at this point in the history
Multi az
  • Loading branch information
mengesb authored Aug 10, 2016
2 parents 6282385 + bc9ec92 commit fbfb1ca
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ tf_hachef CHANGELOG

This file is used to list changes made in each version of the tf_hachef Terraform plan.

v0.2.5 (2016-08-10)
-------------------
- Adding `postgresql.md5_auth_cidr_addresses` to `chef-backend.rb` before joining cluster no longer breaks chef-backend
- attributes-json.tpl -> backend-attributes-json.tpl for consistency

v0.2.4 (2016-08-10)
-------------------
- Fix for #14
Expand Down
File renamed without changes.
15 changes: 6 additions & 9 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@ resource "null_resource" "chef-prep" {
EOF
}
}
# Chef provisiong attributes_json and dna.json templating
resource "template_file" "be-attributes-json" {
# Chef provisiong backend attributes_json and dna.json templating
resource "template_file" "backend-attributes-json" {
count = "${var.chef_backend["count"]}"
template = "${file("${path.module}/files/attributes-json.tpl")}"
template = "${file("${path.module}/files/backend-attributes-json.tpl")}"
vars {
domain = "${var.domain}"
host = "${format("%s-%03d", var.instance_hostname["backend"], count.index + 1)}"
Expand Down Expand Up @@ -262,7 +262,7 @@ resource "aws_instance" "chef-backends" {
provisioner "remote-exec" {
inline = [
"cat > /tmp/dna.json <<EOF",
"${element(template_file.be-attributes-json.*.rendered, count.index)}",
"${element(template_file.backend-attributes-json.*.rendered, count.index)}",
"EOF",
]
}
Expand Down Expand Up @@ -334,12 +334,9 @@ resource "null_resource" "follow_leader" {
# Join cluster
provisioner "remote-exec" {
inline = [
"echo 'postgresql.md5_auth_cidr_addresses = [\"samehost\",\"samenet\",\"${var.vpc["cidr"]}\"]'|sudo tee -a /etc/chef-backend/chef-backend.rb",
"sudo chef-backend-ctl join-cluster ${aws_instance.chef-backends.0.private_ip} --accept-license --quiet -s /tmp/chef-backend-secrets.json -y",
"[ $? -eq 0 ] && rm -rf /tmp/chef-backend-secrets.json",
"sudo chef-backend-ctl cluster-status",
"echo 'postgresql.md5_auth_cidr_addresses = [\"samehost\",\"samenet\",\"${var.vpc["cidr"]}\"]'|sudo tee -a /etc/chef-backend/chef-backend.rb",
"sudo chef-backend-ctl restart",
"sudo chef-backend-ctl reconfigure",
]
}
# Release cluster joining lock
Expand All @@ -365,7 +362,7 @@ resource "aws_route53_record" "chef-backends-public" {
}
#
# Frontend: chef-server-core
# Chef provisiong attributes_json and dna.json templating
# Chef provisiong frontend attributes_json and dna.json templating
resource "template_file" "frontend-attributes-json" {
count = "${var.chef_server["count"]}"
template = "${file("${path.module}/files/frontend-attributes-json.tpl")}"
Expand Down

0 comments on commit fbfb1ca

Please sign in to comment.