diff --git a/prod/syncthing-packer/terraform/.terraform.lock.hcl b/prod/syncthing-packer/terraform/.terraform.lock.hcl index f7f7ed8..3cc9bda 100755 --- a/prod/syncthing-packer/terraform/.terraform.lock.hcl +++ b/prod/syncthing-packer/terraform/.terraform.lock.hcl @@ -21,3 +21,20 @@ provider "registry.terraform.io/digitalocean/digitalocean" { "zh:fee52e736edc5ef4088cedae6507790f35e4ee8a078bff1ef894a51dd65d058d", ] } + +provider "registry.terraform.io/hashicorp/local" { + version = "2.0.0" + hashes = [ + "h1:pO1ANXtOCRfecKsY9Hn4UsXoPBLv6LFiDIEiS1MZ09E=", + "zh:34ce8b79493ace8333d094752b579ccc907fa9392a2c1d6933a6c95d0786d3f1", + "zh:5c5a19c4f614a4ffb68bae0b0563f3860115cf7539b8adc21108324cfdc10092", + "zh:67ddb1ca2cd3e1a8f948302597ceb967f19d2eeb2d125303493667388fe6330e", + "zh:68e6b16f3a8e180fcba1a99754118deb2d82331b51f6cca39f04518339bfdfa6", + "zh:8393a12eb11598b2799d51c9b0a922a3d9fadda5a626b94a1b4914086d53120e", + "zh:90daea4b2010a86f2aca1e3a9590e0b3ddcab229c2bd3685fae76a832e9e836f", + "zh:99308edc734a0ac9149b44f8e316ca879b2670a1cae387a8ae754c180b57cdb4", + "zh:c76594db07a9d1a73372a073888b672df64adb455d483c2426cc220eda7e092e", + "zh:dc09c1fb36c6a706bdac96cce338952888c8423978426a09f5df93031aa88b84", + "zh:deda88134e9780319e8de91b3745520be48ead6ec38cb662694d09185c3dac70", + ] +} diff --git a/prod/syncthing-packer/terraform/main.tf b/prod/syncthing-packer/terraform/main.tf index 0fbe74f..82e7676 100644 --- a/prod/syncthing-packer/terraform/main.tf +++ b/prod/syncthing-packer/terraform/main.tf @@ -19,9 +19,20 @@ data "terraform_remote_state" "do_ssh_keys" { } } +data "local_file" "packer_manifest" { + filename = "${path.module}/../packer/packer-manifest.json" +} + +locals { + packer_manifest = jsondecode(data.local_file.packer_manifest.content) + packer_builds = local.packer_manifest.builds + packer_image_str = element(local.packer_builds, length(local.packer_builds) - 1).artifact_id + packer_image = split(":", local.packer_image_str)[1] +} + resource "digitalocean_droplet" "syncthing" { name = "syncthing" - image = "76123201" + image = local.packer_image region = "nyc1" size = "s-1vcpu-1gb" backups = true