Skip to content

Commit 93ee5bc

Browse files
committed
tf: Add local variable for worker_macs
This variable doesn't assume that port[1] == "eth0", instead it grabs the mac for the port whos name is eth0. It also keeps track of the mac(s) in an array because I was messing with multiple workers at one point and the logic to figure this out was tricky and I don't want to lose it. Signed-off-by: Manuel Mendez <[email protected]>
1 parent 0dec917 commit 93ee5bc

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

deploy/terraform/locals.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
locals {
2+
worker_macs = flatten([for wp in metal_device.tink_worker[*].ports[*] : [for p in wp : p.mac if p.name == "eth0"]])
3+
}

deploy/terraform/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ resource "null_resource" "setup" {
102102
provisioner "remote-exec" {
103103
inline = [
104104
"cd /root && tar zxvf /root/compose.tar.gz -C /root/sandbox",
105-
"cd /root/sandbox/compose && TINKERBELL_CLIENT_MAC=${metal_device.tink_worker.ports[1].mac} TINKERBELL_TEMPLATE_MANIFEST=/manifests/template/ubuntu-equinix-metal.yaml TINKERBELL_HARDWARE_MANIFEST=/manifests/hardware/hardware-equinix-metal.json docker-compose up -d",
105+
"cd /root/sandbox/compose && TINKERBELL_CLIENT_MAC=${local.worker_macs[0]} TINKERBELL_TEMPLATE_MANIFEST=/manifests/template/ubuntu-equinix-metal.yaml TINKERBELL_HARDWARE_MANIFEST=/manifests/hardware/hardware-equinix-metal.json docker-compose up -d",
106106
]
107107
}
108108
}

0 commit comments

Comments
 (0)