diff --git a/deploy/terraform/.terraform.lock.hcl b/deploy/terraform/.terraform.lock.hcl new file mode 100644 index 00000000..275d782f --- /dev/null +++ b/deploy/terraform/.terraform.lock.hcl @@ -0,0 +1,63 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/equinix/metal" { + version = "3.1.0" + constraints = "3.1.0" + hashes = [ + "h1:9qdLMOS8tATAqb9IDjP7tfaC0hpWU7dJquvha84Basc=", + "zh:070b77456a3de02b623be29f1752b48c17100533a98661b7c6555ad2b60aeb1b", + "zh:140b4bfb72810b2e977e7fe442a5b69096db93fe3daff6e307574a541079eb42", + "zh:1d9bf5ba1e05b55af6f5d3e37fa9c0dd4c9fed02e0d47112945c16561f10fe38", + "zh:2b380fb077bb21296e1560c37efd051a7bb31fa488fbe525f54a166ace8cccc8", + "zh:5120fd9f3164e06473d813206e4f06d3b330a351ef6f59114546e0170a49f542", + "zh:5b131619662a36af7f0691c9505d24462533965391039b5664855e50b64db7c4", + "zh:7d3b2f2e2d1a0073ae54070e5dee37713726f6401f26d046db8a5cf58c80cebc", + "zh:7d40ec64e8a3f77c272c9e0cfc8bb6fc148e11a130ef0f022291947313798ec1", + "zh:7fe35422891a14ed233080303468221d8a9f98cd74b0fe73688569cbfc19ff4c", + "zh:a9bb9bfe0928bbc15c132004b3ef573983bb14cc59af9fb492b4f59f2d159054", + "zh:bd7000a809e2e96f87ac7ef90c953a05a8813feb220f27cccc50232f1ae02a50", + "zh:c0656d79d71b893fabcc8420774b8c2d5e2c77feb2b7fecd5dfb9be24228d392", + "zh:f1c755853d4c988fc616e8b1cf8407ed425a0e9ef35a441c0e9eb37657aa9907", + ] +} + +provider "registry.terraform.io/hashicorp/null" { + version = "2.1.2" + constraints = "~> 2.1.2" + hashes = [ + "h1:l0/ASa/TB1exgqdi33sOkFakJL2zAQBu+q5LgO5/SxI=", + "zh:0cc7236c1fbf971b8bad1540a7d0c5ac4579248239fd1034c023b0b660a8d1d5", + "zh:16fc2d9b10cf9e5123bf956e7032c338cc93a03be1ca2e9f3d3b7014c0e866c7", + "zh:1e26465ff40ded59cef1a9e745752eef9744471e69094d12f8bc40a060e8cdb9", + "zh:3c7afd28076245f455d4348af6c124b73409722be4a73680d4e4709a4f25ea91", + "zh:4190a92567efaa444527f19b28d65fac1a01aeba907013b5dceacd9ba2a23709", + "zh:677963437316b088fc1aac70fe7d608d2917c46530c4a25ec86a43e9acaf2811", + "zh:69fe15f6b851ff82700bc749c50a9299770515617e677c18cba2cb697daaff36", + "zh:6b505cc60cc1494e1cab61590bca127b06dd894d0b2a7dcacd23862bce1f492b", + "zh:719aa11ad7be974085af595089478eb24d5a021bc7b08364fa6745d9eb473dac", + "zh:7375b02189e14efbfaab994cd05d81e3ff8e46041fae778598b3903114093a3e", + "zh:c406573b2084a08f8faa0451923fbeb1ca6c5a5598bf039589ec2db13aacc622", + "zh:fb11299a3b20711595713d126abbbe78c554eb5995b02db536e9253686798fb6", + ] +} + +provider "registry.terraform.io/hashicorp/template" { + version = "2.1.2" + constraints = "~> 2.1.2" + hashes = [ + "h1:a61DkglpoCGihJWQDBO0wJovPKXm9K6GLau2l+Q6EdA=", + "zh:149e4bf47ac21b67f6567767afcd29caaf0b0ca43714748093a00a2a98cd17a8", + "zh:2ff61a5eb7550e0df2baefccea78a8b621faef76154aad7ddf9c85c1d69f7ebf", + "zh:3b2d9a9f80754eb0a250a80e0dfdef385501697850a54ead744d1615e60fe648", + "zh:545b93c818035aac59f4a821644276c123a74aa210b1221974d832a6009df201", + "zh:5508512a522152a302591b399512fa736d8f57088c85ca74f7e00014db3a8c26", + "zh:701b56016a6db814ade171877375a2429b45979f97c2d112e4f2103f0433eb08", + "zh:90fc08165958538d8a099f17282c615d5b13f86bb215af33e2ca7551bf81996f", + "zh:affa6d409060c01a610854a395970d76701d0b07696e1ed6776b3f3b58014104", + "zh:b66ffed670bf0ed6714fa4ac26444a8e22f71ec6da134faf0b1f77fb2c13c666", + "zh:bb3d87db22f0ac56717eadde39690e3e27c1c01b10d0ecbe2e6e39f1e5c4d808", + "zh:c54b9693c9f348591432aabc808cbe1786bcda1cb70d312ef62a24545a14f945", + "zh:e7c8f8506cee5fa28f842714857d412a2b09e61127a0efe2a164c2f3d9bf2619", + ] +} diff --git a/deploy/terraform/main.tf b/deploy/terraform/main.tf index 118ed90a..f726991b 100644 --- a/deploy/terraform/main.tf +++ b/deploy/terraform/main.tf @@ -3,7 +3,7 @@ terraform { required_providers { metal = { source = "equinix/metal" - version = "1.0.0" + version = "3.1.0" } null = { source = "hashicorp/null" @@ -35,7 +35,7 @@ resource "metal_device" "tink_provisioner" { operating_system = "ubuntu_18_04" billing_cycle = "hourly" project_id = var.project_id - user_data = file("install_package.sh") + user_data = file("${path.module}/install_package.sh") } resource "null_resource" "tink_directory" { @@ -52,27 +52,27 @@ resource "null_resource" "tink_directory" { } provisioner "file" { - source = "../../setup.sh" + source = "${path.module}/../../setup.sh" destination = "/root/tink/setup.sh" } provisioner "file" { - source = "../../generate-env.sh" + source = "${path.module}/../../generate-env.sh" destination = "/root/tink/generate-env.sh" } provisioner "file" { - source = "../../current_versions.sh" + source = "${path.module}/../../current_versions.sh" destination = "/root/tink/current_versions.sh" } provisioner "file" { - source = "../../deploy" + source = "${path.module}/../../deploy" destination = "/root/tink" } provisioner "file" { - source = "nat_interface" + source = "${path.module}/nat_interface" destination = "/root/tink/.nat_interface" } @@ -127,18 +127,6 @@ resource "metal_port_vlan_attachment" "worker" { vlan_vnid = metal_vlan.provisioning_vlan.vxlan } -data "template_file" "worker_hardware_data" { - count = var.worker_count - template = file("${path.module}/hardware_data.tpl") - vars = { - id = metal_device.tink_worker[count.index].id - facility_code = metal_device.tink_worker[count.index].deployed_facility - plan_slug = metal_device.tink_worker[count.index].plan - address = "192.168.1.${count.index + 5}" - mac = metal_device.tink_worker[count.index].ports[1].mac - } -} - resource "null_resource" "hardware_data" { count = var.worker_count depends_on = [null_resource.tink_directory] @@ -150,7 +138,13 @@ resource "null_resource" "hardware_data" { } provisioner "file" { - content = data.template_file.worker_hardware_data[count.index].rendered + content = templatefile("${path.module}/hardware_data.tpl", { + id = metal_device.tink_worker[count.index].id + facility_code = metal_device.tink_worker[count.index].deployed_facility + plan_slug = metal_device.tink_worker[count.index].plan + address = "192.168.1.${count.index + 5}" + mac = metal_device.tink_worker[count.index].ports[1].mac + }) destination = "/root/tink/deploy/hardware-data-${count.index}.json" } }