fix: move profile to module

This commit is contained in:
2026-06-26 23:44:30 +01:00
parent fba3827961
commit 83abf1f978
3 changed files with 47 additions and 32 deletions
+25 -1
View File
@@ -14,7 +14,7 @@ resource "incus_instance" "this" {
type = "virtual-machine"
image = var.image
profiles = var.profiles
profiles = concat([incus_profile.this.name], var.profiles)
wait_for {
type = "agent"
@@ -53,3 +53,27 @@ resource "incus_storage_volume" "this" {
"size" = "16GiB"
}
}
resource "incus_profile" "this" {
name = var.name
description = "Default profile for ${var.name}"
project = var.project
config = {
"limits.cpu" = var.cpu
"limits.memory" = var.memory
"boot.autostart" = false
"security.secureboot" = true
}
device {
name = "root"
type = "disk"
properties = {
"pool" = "default"
"path" = "/"
"size" = "16GiB"
}
}
}
+13
View File
@@ -27,6 +27,7 @@ variable "profiles" {
type = list(string)
description = "The profiles for this instance."
nullable = false
default = []
}
variable "network" {
@@ -40,3 +41,15 @@ variable "ipv4_address" {
description = "The IPv4 address for this instance."
nullable = false
}
variable "cpu" {
type = number
description = "The number of CPUs for this instance."
nullable = false
}
variable "memory" {
type = string
description = "The amount of memory allocated for this instance."
nullable = false
}