forked from Fediversity/Fediversity
null_resource -> terraform_data
This commit is contained in:
parent
c91361e7d5
commit
6a105c2fce
1 changed files with 13 additions and 6 deletions
|
@ -98,19 +98,26 @@ data "external" "hash" {
|
||||||
program = ["echo", "{\"hash\":\"$(nix-hash ..)\"}"]
|
program = ["echo", "{\"hash\":\"$(nix-hash ..)\"}"]
|
||||||
}
|
}
|
||||||
|
|
||||||
# merge instantiate/deploy, cuz i don't want 24+s instantiates when nothing changed.
|
# merged instantiate/deploy to prevent 24+s instantiates when nothing changed.
|
||||||
# terraform-nixos separates these to only deploy if instantiate changed.
|
# terraform-nixos separates these to only deploy if instantiate changed.
|
||||||
# FIXME find a better solution for this. current considerations were:
|
# FIXME find a better solution for this. current considerations were:
|
||||||
# - `resource null_resource` cannot have outputs, while we want info from the instantiation (unless built on host?).
|
# - generic resources cannot have outputs, while we want info from the instantiation (unless built on host?).
|
||||||
# - `data external` always runs, which is undesirable for steps like deploy/instantiation.
|
# - `data` always runs, which is slow for deploy/instantiation.
|
||||||
# FIXME null_resource docs recommend terraform_data over null_resource
|
resource "terraform_data" "nixos" {
|
||||||
resource "null_resource" "deploy_nixos" {
|
|
||||||
for_each = {for name, inst in merge(
|
for_each = {for name, inst in merge(
|
||||||
local.peripherals,
|
local.peripherals,
|
||||||
local.applications,
|
local.applications,
|
||||||
) : name => inst if inst.cfg.enable}
|
) : name => inst if inst.cfg.enable}
|
||||||
|
|
||||||
triggers = data.external.hash.result
|
triggers_replace = [
|
||||||
|
data.external.hash.result,
|
||||||
|
var.deploy_environment,
|
||||||
|
var.domain,
|
||||||
|
var.initialUser,
|
||||||
|
local.system,
|
||||||
|
each.key,
|
||||||
|
each.value,
|
||||||
|
]
|
||||||
|
|
||||||
provisioner "local-exec" {
|
provisioner "local-exec" {
|
||||||
working_dir = path.root
|
working_dir = path.root
|
||||||
|
|
Loading…
Add table
Reference in a new issue