@@ -3,7 +3,7 @@ terraform {
3
3
required_providers {
4
4
metal = {
5
5
source = " equinix/metal"
6
- version = " 1.0 .0"
6
+ version = " 3.1 .0"
7
7
}
8
8
null = {
9
9
source = " hashicorp/null"
@@ -35,7 +35,7 @@ resource "metal_device" "tink_provisioner" {
35
35
operating_system = " ubuntu_18_04"
36
36
billing_cycle = " hourly"
37
37
project_id = var. project_id
38
- user_data = file (" install_package.sh" )
38
+ user_data = file (" ${ path . module } / install_package.sh" )
39
39
}
40
40
41
41
resource "null_resource" "tink_directory" {
@@ -52,27 +52,27 @@ resource "null_resource" "tink_directory" {
52
52
}
53
53
54
54
provisioner "file" {
55
- source = " ../../setup.sh"
55
+ source = " ${ path . module } / ../../setup.sh"
56
56
destination = " /root/tink/setup.sh"
57
57
}
58
58
59
59
provisioner "file" {
60
- source = " ../../generate-env.sh"
60
+ source = " ${ path . module } / ../../generate-env.sh"
61
61
destination = " /root/tink/generate-env.sh"
62
62
}
63
63
64
64
provisioner "file" {
65
- source = " ../../current_versions.sh"
65
+ source = " ${ path . module } / ../../current_versions.sh"
66
66
destination = " /root/tink/current_versions.sh"
67
67
}
68
68
69
69
provisioner "file" {
70
- source = " ../../deploy"
70
+ source = " ${ path . module } / ../../deploy"
71
71
destination = " /root/tink"
72
72
}
73
73
74
74
provisioner "file" {
75
- source = " nat_interface"
75
+ source = " ${ path . module } / nat_interface"
76
76
destination = " /root/tink/.nat_interface"
77
77
}
78
78
@@ -127,18 +127,6 @@ resource "metal_port_vlan_attachment" "worker" {
127
127
vlan_vnid = metal_vlan. provisioning_vlan . vxlan
128
128
}
129
129
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
-
142
130
resource "null_resource" "hardware_data" {
143
131
count = var. worker_count
144
132
depends_on = [null_resource. tink_directory ]
@@ -150,7 +138,13 @@ resource "null_resource" "hardware_data" {
150
138
}
151
139
152
140
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
+ })
154
148
destination = " /root/tink/deploy/hardware-data-${ count . index } .json"
155
149
}
156
150
}
0 commit comments