diff --git a/incus/groups.tf b/incus/groups.tf index ee6dc90..a2cdf70 100644 --- a/incus/groups.tf +++ b/incus/groups.tf @@ -4,7 +4,7 @@ resource "incus_cluster_group" "default" { } resource "incus_cluster_group_member" "hypervisor" { - for_each = var.incus_hypervisors + for_each = var.hypervisors cluster_group = incus_cluster_group.default.name member = each.key } @@ -15,7 +15,7 @@ resource "incus_cluster_group" "witness" { } resource "incus_cluster_group_member" "witness" { - for_each = var.incus_witnesses + for_each = var.witnesses cluster_group = incus_cluster_group.witness.name member = each.key } diff --git a/incus/members.auto.tfvars b/incus/members.auto.tfvars index 202c182..e4f4727 100644 --- a/incus/members.auto.tfvars +++ b/incus/members.auto.tfvars @@ -1,10 +1,10 @@ -incus_hypervisors = { +hypervisors = { "hv-01" = "https://192.168.0.11:8443" "hv-02" = "https://192.168.0.12:8443" } -incus_witnesses = { +witnesses = { "nuc" = "https://192.168.0.10:8443" } -incus_token = "eyJjbGllbnRfbmFtZSI6InRmIiwiZmluZ2VycHJpbnQiOiIxYjNmZGJmNTNlZTdlODc4NDllY2RiNTkyYzNkYTRkYmE0M2I3Mjg1OTFlYTAxYmE1NTNkZGRmYzJjNTBjNWMzIiwiYWRkcmVzc2VzIjpbIjE5Mi4xNjguMC4xMTo4NDQzIl0sInNlY3JldCI6IjAzNzFmMTdjMDc1OGU2ZmU5ZGJjNTkwZmNhYTAzOTllYWJkMDY3N2E4ODIzMGY1ZjkyYzdlNjNlYmMyYmU0NDQiLCJleHBpcmVzX2F0IjoiMDAwMS0wMS0wMVQwMDowMDowMFoifQ==" +token ="eyJjbGllbnRfbmFtZSI6InRmIiwiZmluZ2VycHJpbnQiOiIxYjNmZGJmNTNlZTdlODc4NDllY2RiNTkyYzNkYTRkYmE0M2I3Mjg1OTFlYTAxYmE1NTNkZGRmYzJjNTBjNWMzIiwiYWRkcmVzc2VzIjpbIjE5Mi4xNjguMC4xMTo4NDQzIl0sInNlY3JldCI6IjAzNzFmMTdjMDc1OGU2ZmU5ZGJjNTkwZmNhYTAzOTllYWJkMDY3N2E4ODIzMGY1ZjkyYzdlNjNlYmMyYmU0NDQiLCJleHBpcmVzX2F0IjoiMDAwMS0wMS0wMVQwMDowMDowMFoifQ==" diff --git a/incus/network.auto.tfvars b/incus/network.auto.tfvars index 55df2f7..0efec52 100644 --- a/incus/network.auto.tfvars +++ b/incus/network.auto.tfvars @@ -1,4 +1,4 @@ -incus_networks = { +networks = { "main" = { type = "physical" hypervisor_config = { diff --git a/incus/network.tf b/incus/network.tf index b9bde5e..90b0884 100644 --- a/incus/network.tf +++ b/incus/network.tf @@ -1,10 +1,10 @@ module "network" { source = "./modules/network" - for_each = var.incus_networks + for_each = var.networks name = each.key type = each.value.type - hypervisors = toset(keys(var.incus_hypervisors)) - witnesses = toset(keys(var.incus_witnesses)) + hypervisors = toset(keys(var.hypervisors)) + witnesses = toset(keys(var.witnesses)) hypervisor_config = each.value.hypervisor_config witness_config = each.value.witness_config } diff --git a/incus/provider.tf b/incus/provider.tf index 4f9eea7..39746f1 100644 --- a/incus/provider.tf +++ b/incus/provider.tf @@ -9,14 +9,14 @@ terraform { provider "incus" { generate_client_certificates = true accept_remote_certificate = true - default_remote = keys(var.incus_hypervisors)[0] + default_remote = keys(var.hypervisors)[0] dynamic "remote" { - for_each = var.incus_hypervisors + for_each = var.hypervisors content { name = remote.key address = remote.value - token = var.incus_token + token = var.token } } } diff --git a/incus/storage.auto.tfvars b/incus/storage.auto.tfvars index f0a9b82..14d64b3 100644 --- a/incus/storage.auto.tfvars +++ b/incus/storage.auto.tfvars @@ -1,4 +1,4 @@ -incus_storage_pools = { +storage_pools = { "san" = { driver = "lvmcluster" hypervisor_config = { "lvm.vg_name" = "nucVG" } diff --git a/incus/storage.tf b/incus/storage.tf index e14b04e..0837bae 100644 --- a/incus/storage.tf +++ b/incus/storage.tf @@ -1,10 +1,10 @@ module "storage" { source = "./modules/storage" - for_each = var.incus_storage_pools + for_each = var.storage_pools name = each.key driver = each.value.driver - hypervisors = toset(keys(var.incus_hypervisors)) - witnesses = toset(keys(var.incus_witnesses)) + hypervisors = toset(keys(var.hypervisors)) + witnesses = toset(keys(var.witnesses)) hypervisor_config = each.value.hypervisor_config witness_config = each.value.witness_config } diff --git a/incus/variables.tf b/incus/variables.tf index eb18cc1..223275f 100644 --- a/incus/variables.tf +++ b/incus/variables.tf @@ -1,18 +1,18 @@ -variable "incus_hypervisors" { +variable "hypervisors" { type = map(string) } -variable "incus_witnesses" { +variable "witnesses" { type = map(string) } -variable "incus_token" { +variable "token" { type = string sensitive = true description = "The common authentication token for all Incus remotes" } -variable "incus_networks" { +variable "networks" { type = map(object({ type = string hypervisor_config = map(string) @@ -20,7 +20,7 @@ variable "incus_networks" { })) } -variable "incus_storage_pools" { +variable "storage_pools" { type = map(object({ driver = string hypervisor_config = map(string)