added null ressouce to destroy lb
This commit is contained in:
parent
4e3858e54b
commit
6739b4a493
17
main.tf
17
main.tf
@ -158,3 +158,20 @@ data "hcloud_load_balancer" "traefik" {
|
|||||||
|
|
||||||
depends_on = [null_resource.kustomization]
|
depends_on = [null_resource.kustomization]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "null_resource" "destroy_lb" {
|
||||||
|
triggers = {
|
||||||
|
token = random_password.k3s_token.result
|
||||||
|
}
|
||||||
|
|
||||||
|
# Important when issuing terraform destroy, otherwise the LB will not let the network get deleted
|
||||||
|
provisioner "local-exec" {
|
||||||
|
when = destroy
|
||||||
|
command = <<-EOT
|
||||||
|
hcloud load-balancer delete traefik
|
||||||
|
hcloud network delete k3s
|
||||||
|
EOT
|
||||||
|
|
||||||
|
on_failure = continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -66,6 +66,7 @@ rpm --import https://rpm.rancher.io/public.key
|
|||||||
zypper refresh
|
zypper refresh
|
||||||
zypper --gpg-auto-import-keys install -y https://rpm.rancher.io/k3s/stable/common/microos/noarch/k3s-selinux-0.4-1.sle.noarch.rpm
|
zypper --gpg-auto-import-keys install -y https://rpm.rancher.io/k3s/stable/common/microos/noarch/k3s-selinux-0.4-1.sle.noarch.rpm
|
||||||
udevadm settle
|
udevadm settle
|
||||||
|
exit 0
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user