mirror of
https://github.com/2martens/terraform.git
synced 2026-10-17 15:06:51 +02:00
fix: Open port 2377 only on manager nodes
This commit is contained in:
@@ -78,6 +78,7 @@ resource "hcloud_server" "node" {
|
|||||||
packages_setup : base64encode(file("${path.module}/templates/scripts/install-packages.sh"))
|
packages_setup : base64encode(file("${path.module}/templates/scripts/install-packages.sh"))
|
||||||
firewall_setup : base64encode(templatefile("${path.module}/templates/scripts/firewall-setup.sh.tftpl", {
|
firewall_setup : base64encode(templatefile("${path.module}/templates/scripts/firewall-setup.sh.tftpl", {
|
||||||
node_ip : var.private_node_ips[count.index]
|
node_ip : var.private_node_ips[count.index]
|
||||||
|
main_node : count.index == 0
|
||||||
}))
|
}))
|
||||||
ssh_setup : base64encode(templatefile("${path.module}/templates/scripts/ssh-setup.sh.tftpl", {
|
ssh_setup : base64encode(templatefile("${path.module}/templates/scripts/ssh-setup.sh.tftpl", {
|
||||||
admin_user : var.admin_user
|
admin_user : var.admin_user
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ ufw allow OpenSSH
|
|||||||
ufw allow 80 comment HTTP
|
ufw allow 80 comment HTTP
|
||||||
ufw allow 443 comment HTTPS
|
ufw allow 443 comment HTTPS
|
||||||
|
|
||||||
ufw allow to ${node_ip} port 2377 comment "Swarm join port"
|
%{if main_node ~}
|
||||||
|
ufw allow to ${node_ip} port 2377 comment "Swarm join port and communication between manager nodes"
|
||||||
|
%{endif ~}
|
||||||
ufw allow to ${node_ip} port 7946 comment "overlay network node discovery"
|
ufw allow to ${node_ip} port 7946 comment "overlay network node discovery"
|
||||||
ufw allow to ${node_ip} port 4789 comment "overlay network traffic"
|
ufw allow to ${node_ip} port 4789 comment "overlay network traffic"
|
||||||
ufw enable
|
ufw enable
|
||||||
|
|||||||
Reference in New Issue
Block a user