mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 05:36:59 +01:00
Provision loadbalancer with terraform and custom scripts
This commit is contained in:
parent
01b7e79e55
commit
77a6ef36f3
8 changed files with 136 additions and 29 deletions
22
terraform/lb.tf
Normal file
22
terraform/lb.tf
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
resource "null_resource" "load_balancer" {
|
||||
provisioner "local-exec" {
|
||||
command = "./scripts/create_lb.sh lb-k8s-${local.environment} ${var.lb_ip}"
|
||||
}
|
||||
|
||||
provisioner "local-exec" {
|
||||
when = "destroy"
|
||||
command = "./scripts/delete_lb.sh ${var.lb_ip}"
|
||||
}
|
||||
}
|
||||
|
||||
resource "null_resource" "update_load_balancer_rules" {
|
||||
triggers = {
|
||||
node_instance_ids = "${join(",", scaleway_server.node.*.private_ip)}"
|
||||
}
|
||||
|
||||
provisioner "local-exec" {
|
||||
command = "./scripts/update_lb_rules.sh ${var.lb_ip} '${jsonencode(scaleway_server.node.*.private_ip)}'"
|
||||
}
|
||||
|
||||
depends_on = [null_resource.load_balancer]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue