Skip to content

Commit 1febe6d

Browse files
committed
fix terraform resource paths, use templatefile, update metal version
Signed-off-by: Marques Johansson <[email protected]>
1 parent 232cf79 commit 1febe6d

File tree

2 files changed

+77
-20
lines changed

2 files changed

+77
-20
lines changed

deploy/terraform/.terraform.lock.hcl

Lines changed: 63 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/terraform/main.tf

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ terraform {
33
required_providers {
44
metal = {
55
source = "equinix/metal"
6-
version = "1.0.0"
6+
version = "3.1.0"
77
}
88
null = {
99
source = "hashicorp/null"
@@ -35,7 +35,7 @@ resource "metal_device" "tink_provisioner" {
3535
operating_system = "ubuntu_18_04"
3636
billing_cycle = "hourly"
3737
project_id = var.project_id
38-
user_data = file("install_package.sh")
38+
user_data = file("${path.module}/install_package.sh")
3939
}
4040

4141
resource "null_resource" "tink_directory" {
@@ -52,27 +52,27 @@ resource "null_resource" "tink_directory" {
5252
}
5353

5454
provisioner "file" {
55-
source = "../../setup.sh"
55+
source = "${path.module}/../../setup.sh"
5656
destination = "/root/tink/setup.sh"
5757
}
5858

5959
provisioner "file" {
60-
source = "../../generate-env.sh"
60+
source = "${path.module}/../../generate-env.sh"
6161
destination = "/root/tink/generate-env.sh"
6262
}
6363

6464
provisioner "file" {
65-
source = "../../current_versions.sh"
65+
source = "${path.module}/../../current_versions.sh"
6666
destination = "/root/tink/current_versions.sh"
6767
}
6868

6969
provisioner "file" {
70-
source = "../../deploy"
70+
source = "${path.module}/../../deploy"
7171
destination = "/root/tink"
7272
}
7373

7474
provisioner "file" {
75-
source = "nat_interface"
75+
source = "${path.module}/nat_interface"
7676
destination = "/root/tink/.nat_interface"
7777
}
7878

@@ -127,18 +127,6 @@ resource "metal_port_vlan_attachment" "worker" {
127127
vlan_vnid = metal_vlan.provisioning_vlan.vxlan
128128
}
129129

130-
data "template_file" "worker_hardware_data" {
131-
count = var.worker_count
132-
template = file("${path.module}/hardware_data.tpl")
133-
vars = {
134-
id = metal_device.tink_worker[count.index].id
135-
facility_code = metal_device.tink_worker[count.index].deployed_facility
136-
plan_slug = metal_device.tink_worker[count.index].plan
137-
address = "192.168.1.${count.index + 5}"
138-
mac = metal_device.tink_worker[count.index].ports[1].mac
139-
}
140-
}
141-
142130
resource "null_resource" "hardware_data" {
143131
count = var.worker_count
144132
depends_on = [null_resource.tink_directory]
@@ -150,7 +138,13 @@ resource "null_resource" "hardware_data" {
150138
}
151139

152140
provisioner "file" {
153-
content = data.template_file.worker_hardware_data[count.index].rendered
141+
content = templatefile("${path.module}/hardware_data.tpl", {
142+
id = metal_device.tink_worker[count.index].id
143+
facility_code = metal_device.tink_worker[count.index].deployed_facility
144+
plan_slug = metal_device.tink_worker[count.index].plan
145+
address = "192.168.1.${count.index + 5}"
146+
mac = metal_device.tink_worker[count.index].ports[1].mac
147+
})
154148
destination = "/root/tink/deploy/hardware-data-${count.index}.json"
155149
}
156150
}

0 commit comments

Comments
 (0)