diff --git a/incus/buckets.tf b/incus/buckets.tf new file mode 100644 index 0000000..0b29829 --- /dev/null +++ b/incus/buckets.tf @@ -0,0 +1,11 @@ + +# resource "incus_storage_bucket" "mybucket" { +# name = "bucket1" +# pool = "pool1" +# project = "proj" +# } + +# import { +# to = incus_storage_bucket.mybucket +# id = "proj/pool1/mybucket" +# } diff --git a/incus/main.tf b/incus/main.tf new file mode 100644 index 0000000..ff092a9 --- /dev/null +++ b/incus/main.tf @@ -0,0 +1,52 @@ +resource "incus_profile" "d" { + name = "d" + + config = { + "limits.cpu" = 2 + "security.nesting" = true + "boot.autostart" = true + } + + # device { + # name = "shared" + # type = "disk" + + # properties = { + # source = "/tmp" + # path = "/tmp" + # } + # } + + # device { + # type = "disk" + # name = "root" + + # properties = { + # pool = "default" + # path = "/" + # } + # } +} + +resource "incus_instance" "observer-tofu" { + name = "observer-tofu" + image = "images:nixos/25.05/amd64" + profiles = [ + "default", + incus_profile.d.name + ] + config = { + "limits.cpu" = 2 + "limits.memory" = "4GiB" + } + device { + name = "http" + type = "proxy" + properties = { + # Listen on Incus host's TCP port 80 + listen = "tcp:0.0.0.0:8888" + # And connect to the instance's TCP port 80 + connect = "tcp:127.0.0.1:80" + } + } +} diff --git a/incus/providers.tf b/incus/providers.tf new file mode 100644 index 0000000..76d5b5b --- /dev/null +++ b/incus/providers.tf @@ -0,0 +1,8 @@ +terraform { + required_providers { + incus = { + source = "lxc/incus" + version = "0.3.1" + } + } +} diff --git a/main.tf b/main.tf index cac49a3..e6b243a 100644 --- a/main.tf +++ b/main.tf @@ -1,9 +1,3 @@ -# resource "incus_instance" "demo-tofu" { -# name = "demo" -# image = "images:fedora/42" -# config = { -# "boot.autostart" = true -# "limits.cpu" = 2 -# "limits.memory" = "4GiB" -# } -# } +module "lincus" { + source = "./incus" +} diff --git a/providers.tf b/providers.tf index 6131e2e..8c6873a 100644 --- a/providers.tf +++ b/providers.tf @@ -1,6 +1,6 @@ terraform { cloud { - hostname = "tofu.skdevstudios.com" + hostname = "tofu.skdevstudios.com" organization = "skdevs" workspaces { @@ -9,7 +9,7 @@ terraform { } required_providers { incus = { - source = "lxc/incus" + source = "lxc/incus" version = "0.3.1" } }