!VhzbGHamdfMiGxpXyg:robins.wtf

NixOS Incus and LXC

46 Members
lxc, lxd, incus discussions related to NixOS16 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
1 Apr 2025
@hexa:lossy.networkhexasecond person to recommend using it through terranix14:32:44
@adam:robins.wtfadamcstephensI'm guessing you don't want to use nix for this though14:33:05
@hexa:lossy.networkhexawould be nice if I didn't have to introduce nix into that, yeah14:33:31
@hexa:lossy.networkhexabecause tf alone is enough added complexity for the colleagues14:33:40
@adam:robins.wtfadamcstephensright14:33:47
@adam:robins.wtfadamcstephensi have mixed feelings on using nix for it myself, but i already wrote it. 14:33:56
@hexa:lossy.networkhexaso the idea is that I create a set of networks14:34:18
@hexa:lossy.networkhexaand lots of for_each constructions14:34:25
@hexa:lossy.networkhexa but that is not possible for the depends_on in the final network apparently 14:34:40
@hexa:lossy.networkhexa

I can't for example do


  depends_on = [
    "incus_network.incus1-${each.name}",
    "incus_network.incus2-${each.name}",
    "incus_network.incus3-${each.name}",
    "incus_network.incus4-${each.name}",
    "incus_network.incus5-${each.name}",
  ]
14:35:24
@hexa:lossy.networkhexa *

I can't for example do

  depends_on = [
    "incus_network.incus1-${each.name}",
    "incus_network.incus2-${each.name}",
    "incus_network.incus3-${each.name}",
    "incus_network.incus4-${each.name}",
    "incus_network.incus5-${each.name}",
  ]
14:35:28
@adam:robins.wtfadamcstephensthe for_each should create an array of resources14:35:33
@hexa:lossy.networkhexa

A single static variable reference is required: only attribute access and indexing with constant keys. No calculations, function calls, template expressions, etc are allowed here.

14:35:38
@adam:robins.wtfadamcstephensthat's from the tf docs?14:36:34
@hexa:lossy.networkhexathat is the error I get for that code14:36:42
@hexa:lossy.networkhexa
  depends_on = [
    incus_network.incus1-vlan2000,
    incus_network.incus2-vlan2000,
    incus_network.incus3-vlan2000,
    incus_network.incus4-vlan2000,
    incus_network.incus5-vlan2000,
  ]
14:37:12
@hexa:lossy.networkhexathis is what I need14:37:15
@hexa:lossy.networkhexaand what works14:37:17
@hexa:lossy.networkhexabut I have too many networks and I don't want to end up with 1000 LoC14:37:38
@adam:robins.wtfadamcstephens yeah, can you do some data manipulation in a local and use that for the depends_on ? 14:38:17
@hexa:lossy.networkhexahmm, plausible14:39:29
@adam:robins.wtfadamcstephens are you using for_each for incus_network ? 14:40:51
@hexa:lossy.networkhexayes14:40:56
@adam:robins.wtfadamcstephens if you remove the node name from the resource name, can you use incus_network.vlan2000[*] in the depends_on? 14:41:41
@hexa:lossy.networkhexastill means I would have to manually configure the cluster network each time14:42:20
@adam:robins.wtfadamcstephensahh yeah14:42:42
@hexa:lossy.networkhexabecause I cannot template the vlan2000 part into it14:42:43

Show newer messages


Back to Room ListRoom Version: 10