Skip to content

Commit

Permalink
consul: Use GetInterfaceIP for advertise_addr
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed Oct 5, 2024
1 parent 3b77c1a commit 8a12cb2
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 48 deletions.
4 changes: 2 additions & 2 deletions aws/ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ resource "aws_instance" "test_femiwiki" {
}

tags = {
Name = "Test Server"
consul-cloud-auto-join = "true"
Name = "Test Server"
ConsulAutoJoin = "auto-join"
}

lifecycle {
Expand Down
2 changes: 1 addition & 1 deletion aws/res/consul.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ acl {

server = true
node_name = "femiwiki"
advertise_addr = "IP_ADDRESS"
advertise_addr = "{{GetInterfaceIP \"ens5\"}}"
bind_addr = "0.0.0.0"
client_addr = "0.0.0.0"
bootstrap = true
Expand Down
23 changes: 0 additions & 23 deletions aws/res/consul.service

This file was deleted.

20 changes: 0 additions & 20 deletions aws/res/nomad.service

This file was deleted.

2 changes: 0 additions & 2 deletions aws/res/user-data.sh.tftpl
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ dnf install -y "consul-$${CONSUL_VERSION}"
cat <<EOF >/etc/consul.d/consul.hcl
${consul_config}
EOF
IP_ADDRESS=$(curl http://instance-data/latest/meta-data/local-ipv4)
sed -i "s/IP_ADDRESS/$IP_ADDRESS/g" /etc/consul.d/consul.hcl

dnf install -y consul-cni-$${CONSUL_CNI_VERSION}

Expand Down

0 comments on commit 8a12cb2

Please sign in to comment.