-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetallb.tf
36 lines (30 loc) · 994 Bytes
/
metallb.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
resource "null_resource" "install_metallb" {
triggers = {
manifest_sha1 = "${sha1(file("${path.module}/assets/metallb.yaml"))}"
}
provisioner "local-exec" {
command = "${var.kubectl} apply -f ${path.module}/assets/metallb.yaml"
environment = {
KUBECONFIG = var.kubeconfig_path
}
}
depends_on = [null_resource.wait_for_kubernetes]
}
data "template_file" "metallb_config" {
template = file("${path.module}/templates/metallb-config.yaml.tpl")
vars = {
cidr = packet_reserved_ip_block.load_balancer_ips.cidr_notation
}
}
resource "null_resource" "apply_metallb_config" {
triggers = {
manifest_sha1 = "${sha1("${data.template_file.metallb_config.rendered}")}"
}
provisioner "local-exec" {
command = "${var.kubectl} apply -f -<<EOF\n${data.template_file.metallb_config.rendered}\nEOF"
environment = {
KUBECONFIG = var.kubeconfig_path
}
}
depends_on = [null_resource.install_metallb, null_resource.wait_for_kubernetes]
}