56 lines
906 B
HCL
56 lines
906 B
HCL
terraform {
|
|
required_providers {
|
|
incus = {
|
|
source = "lxc/incus"
|
|
version = ">= 1.1.1"
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "incus_instance" "this" {
|
|
name = var.name
|
|
description = var.description
|
|
project = var.project
|
|
|
|
type = "virtual-machine"
|
|
image = var.image
|
|
profiles = var.profiles
|
|
|
|
wait_for {
|
|
type = "agent"
|
|
}
|
|
|
|
device {
|
|
name = "eth0"
|
|
type = "nic"
|
|
|
|
properties = {
|
|
"network" = var.network
|
|
"ipv4.address" = var.ipv4_address
|
|
}
|
|
}
|
|
|
|
device {
|
|
name = "ext"
|
|
type = "disk"
|
|
|
|
properties = {
|
|
"pool" = "default"
|
|
"source" = incus_storage_volume.this.name
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "incus_storage_volume" "this" {
|
|
name = "${var.name}-ext"
|
|
description = "External disk for ${var.name}"
|
|
pool = "default"
|
|
project = var.project
|
|
|
|
content_type = "block"
|
|
|
|
config = {
|
|
"size" = "16GiB"
|
|
}
|
|
}
|