Remove redundant incus_ prefix from root module variables

Rename variables to remove the useless incus_ prefix:
- incus_hypervisors → hypervisors
- incus_witnesses → witnesses
- incus_token → token
- incus_networks → networks
- incus_storage_pools → storage_pools

Updates all references across provider.tf, groups.tf, network.tf,
storage.tf, and .auto.tfvars files.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-03-15 14:09:20 +01:00
parent 36eaa727ab
commit ad2c8145e3
8 changed files with 21 additions and 21 deletions

View File

@@ -4,7 +4,7 @@ resource "incus_cluster_group" "default" {
} }
resource "incus_cluster_group_member" "hypervisor" { resource "incus_cluster_group_member" "hypervisor" {
for_each = var.incus_hypervisors for_each = var.hypervisors
cluster_group = incus_cluster_group.default.name cluster_group = incus_cluster_group.default.name
member = each.key member = each.key
} }
@@ -15,7 +15,7 @@ resource "incus_cluster_group" "witness" {
} }
resource "incus_cluster_group_member" "witness" { resource "incus_cluster_group_member" "witness" {
for_each = var.incus_witnesses for_each = var.witnesses
cluster_group = incus_cluster_group.witness.name cluster_group = incus_cluster_group.witness.name
member = each.key member = each.key
} }

View File

@@ -1,10 +1,10 @@
incus_hypervisors = { hypervisors = {
"hv-01" = "https://192.168.0.11:8443" "hv-01" = "https://192.168.0.11:8443"
"hv-02" = "https://192.168.0.12:8443" "hv-02" = "https://192.168.0.12:8443"
} }
incus_witnesses = { witnesses = {
"nuc" = "https://192.168.0.10:8443" "nuc" = "https://192.168.0.10:8443"
} }
incus_token = "eyJjbGllbnRfbmFtZSI6InRmIiwiZmluZ2VycHJpbnQiOiIxYjNmZGJmNTNlZTdlODc4NDllY2RiNTkyYzNkYTRkYmE0M2I3Mjg1OTFlYTAxYmE1NTNkZGRmYzJjNTBjNWMzIiwiYWRkcmVzc2VzIjpbIjE5Mi4xNjguMC4xMTo4NDQzIl0sInNlY3JldCI6IjAzNzFmMTdjMDc1OGU2ZmU5ZGJjNTkwZmNhYTAzOTllYWJkMDY3N2E4ODIzMGY1ZjkyYzdlNjNlYmMyYmU0NDQiLCJleHBpcmVzX2F0IjoiMDAwMS0wMS0wMVQwMDowMDowMFoifQ==" token ="eyJjbGllbnRfbmFtZSI6InRmIiwiZmluZ2VycHJpbnQiOiIxYjNmZGJmNTNlZTdlODc4NDllY2RiNTkyYzNkYTRkYmE0M2I3Mjg1OTFlYTAxYmE1NTNkZGRmYzJjNTBjNWMzIiwiYWRkcmVzc2VzIjpbIjE5Mi4xNjguMC4xMTo4NDQzIl0sInNlY3JldCI6IjAzNzFmMTdjMDc1OGU2ZmU5ZGJjNTkwZmNhYTAzOTllYWJkMDY3N2E4ODIzMGY1ZjkyYzdlNjNlYmMyYmU0NDQiLCJleHBpcmVzX2F0IjoiMDAwMS0wMS0wMVQwMDowMDowMFoifQ=="

View File

@@ -1,4 +1,4 @@
incus_networks = { networks = {
"main" = { "main" = {
type = "physical" type = "physical"
hypervisor_config = { hypervisor_config = {

View File

@@ -1,10 +1,10 @@
module "network" { module "network" {
source = "./modules/network" source = "./modules/network"
for_each = var.incus_networks for_each = var.networks
name = each.key name = each.key
type = each.value.type type = each.value.type
hypervisors = toset(keys(var.incus_hypervisors)) hypervisors = toset(keys(var.hypervisors))
witnesses = toset(keys(var.incus_witnesses)) witnesses = toset(keys(var.witnesses))
hypervisor_config = each.value.hypervisor_config hypervisor_config = each.value.hypervisor_config
witness_config = each.value.witness_config witness_config = each.value.witness_config
} }

View File

@@ -9,14 +9,14 @@ terraform {
provider "incus" { provider "incus" {
generate_client_certificates = true generate_client_certificates = true
accept_remote_certificate = true accept_remote_certificate = true
default_remote = keys(var.incus_hypervisors)[0] default_remote = keys(var.hypervisors)[0]
dynamic "remote" { dynamic "remote" {
for_each = var.incus_hypervisors for_each = var.hypervisors
content { content {
name = remote.key name = remote.key
address = remote.value address = remote.value
token = var.incus_token token = var.token
} }
} }
} }

View File

@@ -1,4 +1,4 @@
incus_storage_pools = { storage_pools = {
"san" = { "san" = {
driver = "lvmcluster" driver = "lvmcluster"
hypervisor_config = { "lvm.vg_name" = "nucVG" } hypervisor_config = { "lvm.vg_name" = "nucVG" }

View File

@@ -1,10 +1,10 @@
module "storage" { module "storage" {
source = "./modules/storage" source = "./modules/storage"
for_each = var.incus_storage_pools for_each = var.storage_pools
name = each.key name = each.key
driver = each.value.driver driver = each.value.driver
hypervisors = toset(keys(var.incus_hypervisors)) hypervisors = toset(keys(var.hypervisors))
witnesses = toset(keys(var.incus_witnesses)) witnesses = toset(keys(var.witnesses))
hypervisor_config = each.value.hypervisor_config hypervisor_config = each.value.hypervisor_config
witness_config = each.value.witness_config witness_config = each.value.witness_config
} }

View File

@@ -1,18 +1,18 @@
variable "incus_hypervisors" { variable "hypervisors" {
type = map(string) type = map(string)
} }
variable "incus_witnesses" { variable "witnesses" {
type = map(string) type = map(string)
} }
variable "incus_token" { variable "token" {
type = string type = string
sensitive = true sensitive = true
description = "The common authentication token for all Incus remotes" description = "The common authentication token for all Incus remotes"
} }
variable "incus_networks" { variable "networks" {
type = map(object({ type = map(object({
type = string type = string
hypervisor_config = map(string) hypervisor_config = map(string)
@@ -20,7 +20,7 @@ variable "incus_networks" {
})) }))
} }
variable "incus_storage_pools" { variable "storage_pools" {
type = map(object({ type = map(object({
driver = string driver = string
hypervisor_config = map(string) hypervisor_config = map(string)