Add reusable storage pool module with lvmcluster san pool

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-15 09:59:02 +01:00
parent 75273421fe
commit 6b53db3ad9
6 changed files with 89 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
terraform {
required_providers {
incus = {
source = "lxc/incus"
}
}
}
resource "incus_storage_pool" "hypervisor" {
for_each = var.hypervisors
name = var.name
driver = var.driver
target = each.key
config = var.hypervisor_config
}
resource "incus_storage_pool" "witness" {
for_each = var.witnesses
name = var.name
driver = var.driver
target = each.key
config = var.witness_config
}
resource "incus_storage_pool" "this" {
depends_on = [
incus_storage_pool.hypervisor,
incus_storage_pool.witness,
]
name = var.name
driver = var.driver
}

View File

@@ -0,0 +1,7 @@
output "name" {
value = incus_storage_pool.this.name
}
output "driver" {
value = incus_storage_pool.this.driver
}

View File

@@ -0,0 +1,25 @@
variable "name" {
type = string
}
variable "driver" {
type = string
}
variable "hypervisors" {
type = set(string)
}
variable "witnesses" {
type = set(string)
}
variable "hypervisor_config" {
type = map(string)
default = {}
}
variable "witness_config" {
type = map(string)
default = {}
}