| 1 Apr 2025 |
hexa | second person to recommend using it through terranix | 14:32:44 |
adamcstephens | I'm guessing you don't want to use nix for this though | 14:33:05 |
hexa | would be nice if I didn't have to introduce nix into that, yeah | 14:33:31 |
hexa | because tf alone is enough added complexity for the colleagues | 14:33:40 |
adamcstephens | right | 14:33:47 |
adamcstephens | i have mixed feelings on using nix for it myself, but i already wrote it. | 14:33:56 |
hexa | so the idea is that I create a set of networks | 14:34:18 |
hexa | and lots of for_each constructions | 14:34:25 |
hexa | but that is not possible for the depends_on in the final network apparently | 14:34:40 |
hexa | 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 | * 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 |
adamcstephens | the for_each should create an array of resources | 14:35:33 |
hexa |
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 |
adamcstephens | that's from the tf docs? | 14:36:34 |
hexa | that is the error I get for that code | 14:36:42 |
hexa | 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 | this is what I need | 14:37:15 |
hexa | and what works | 14:37:17 |
hexa | but I have too many networks and I don't want to end up with 1000 LoC | 14:37:38 |
adamcstephens | yeah, can you do some data manipulation in a local and use that for the depends_on ? | 14:38:17 |
hexa | hmm, plausible | 14:39:29 |
adamcstephens | are you using for_each for incus_network ? | 14:40:51 |
hexa | yes | 14:40:56 |
adamcstephens | if you remove the node name from the resource name, can you use incus_network.vlan2000[*] in the depends_on? | 14:41:41 |
hexa | still means I would have to manually configure the cluster network each time | 14:42:20 |
adamcstephens | ahh yeah | 14:42:42 |
hexa | because I cannot template the vlan2000 part into it | 14:42:43 |