verbena: configure IPv6 from tofu outputs
This commit is contained in:
parent
3834f215f0
commit
abaf429a38
4 changed files with 58 additions and 0 deletions
|
|
@ -19,3 +19,8 @@ tofu import hcloud_firewall.hcloud_firewall YYY
|
|||
```
|
||||
|
||||
For Hetzner Cloud, the resource IDs can be found in the URL of the admin console.
|
||||
|
||||
## Outputs
|
||||
|
||||
The nix configuration reads some values from the `outputs.json` file.
|
||||
When modifying these, the file should be regenerated with `tofu output -json > outputs.json`.
|
||||
|
|
|
|||
17
infra/outputs.json
Normal file
17
infra/outputs.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"verbena_gateway6": {
|
||||
"sensitive": false,
|
||||
"type": "string",
|
||||
"value": "2001:41d0:305:2100::1"
|
||||
},
|
||||
"verbena_ipv4": {
|
||||
"sensitive": false,
|
||||
"type": "string",
|
||||
"value": "51.68.122.153"
|
||||
},
|
||||
"verbena_ipv6": {
|
||||
"sensitive": false,
|
||||
"type": "string",
|
||||
"value": "2001:41d0:305:2100::271e"
|
||||
}
|
||||
}
|
||||
20
infra/verbena.tf
Normal file
20
infra/verbena.tf
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
output "verbena_ipv4" {
|
||||
value = local.verbena_ipv4_addresses[0]
|
||||
}
|
||||
|
||||
output "verbena_ipv6" {
|
||||
value = local.verbena_ipv6_addresses[0]
|
||||
}
|
||||
|
||||
output "verbena_gateway6" {
|
||||
value = local.gateway6
|
||||
}
|
||||
|
||||
locals {
|
||||
hextets = 4
|
||||
parts = split(":", local.verbena_ipv6_addresses[0])
|
||||
prefix_parts = slice(local.parts, 0, local.hextets)
|
||||
prefix_str = join(":", local.prefix_parts)
|
||||
gateway6 = "${local.prefix_str}::1"
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue