| main.tf - infra - Terraform IoC for my remote (Hetzner) and local (Incus) serve… | |
| git clone git://jay.scot/infra | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| main.tf (1277B) | |
| --- | |
| 1 terraform { | |
| 2 required_providers { | |
| 3 incus = { | |
| 4 source = "lxc/incus" | |
| 5 version = "0.1.2" | |
| 6 } | |
| 7 } | |
| 8 } | |
| 9 | |
| 10 provider "incus" { | |
| 11 generate_client_certificates = true | |
| 12 accept_remote_certificate = true | |
| 13 | |
| 14 remote { | |
| 15 name = "incus-server-1" | |
| 16 scheme = "https" | |
| 17 address = "192.168.1.148" | |
| 18 token = "eyJjbGllbnRfbmFtZSI6InRlcnJhZm9ybSIsImZpbmdlcnByaW50IjoiO… | |
| 19 default = true | |
| 20 } | |
| 21 } | |
| 22 | |
| 23 resource "incus_instance" "main" { | |
| 24 for_each = var.nodes | |
| 25 | |
| 26 name = each.key | |
| 27 image = each.value.image | |
| 28 | |
| 29 config = { | |
| 30 "cloud-init.user-data" = file(each.value.cloudinit_userdata) | |
| 31 "cloud-init.network-config" = templatefile("templates/network.tftpl"… | |
| 32 addr = each.value.net_addr, gw = each.value.net_gw | |
| 33 }) | |
| 34 } | |
| 35 | |
| 36 dynamic "device" { | |
| 37 for_each = each.value.devices | |
| 38 | |
| 39 content { | |
| 40 name = device.key | |
| 41 type = device.value.type | |
| 42 properties = device.value.properties | |
| 43 } | |
| 44 | |
| 45 } | |
| 46 } |