chore(templates): Added IaaS Instance

This commit is contained in:
l-nmch
2026-03-22 02:35:30 +01:00
commit 74d27be222
5 changed files with 328 additions and 0 deletions

56
iaas-instance/README.md Normal file
View File

@@ -0,0 +1,56 @@
> Based on the work of [umair](https://github.com/l-nmch/registry/tree/main/registry/umair)
# Incus VM Template for Coder
Provision Linux VMs & Containers on Incus/LXD as [Coder workspaces](https://coder.phorge.fr). The template deploys an instance with cloud-init, and runs the Coder agent under the workspace owner's Linux user.
## Prerequisites
- Incus server / cluster with exposed API
### Setup the template
1. Create an Incus trust token:
```bash
incus config trust add coder # Save the token
```
2. Setup an Incus project with a network:
```bash
incus project create Coder -c features.network=true
incus network create Main --project Coder
```
3. Prepare `terraform.tfvars` in your environment:
```py
remote_name = "iaas"
remote_address = "https://iaas.phorge.fr:443"
remote_token = "<token>"
remote_coder_project = "Coder"
remote_coder_network = "Main"
remote_coder_storage_pool = "local"
remote_coder_profiles = ["1vCPU-1GiB-20GB", "2vCPU-2GiB-20GB"]
remote_coder_images = ["images:ubuntu/24.04/cloud", "images:debian/13/cloud", "images:alpine/3.23/cloud"]
```
## Use
```bash
coder template push iaas-instance -d .
```
## Warnings
Incus often works with cloud image, please use `cloud` tagged images such as `images:ubuntu/22.04/cloud` to be able to use cloud-init (Using non cloud tagged images will lead into your workspaces not working as the coder agent installs through cloud-init)
## References
- Incus: [source](https://linuxcontainers.org/incus/)
- Incus Terraform Provider: [source](https://registry.terraform.io/providers/lxc/incus/latest/docs)
- Coder Best practices & templates:
- https://coder.com/docs/tutorials/best-practices/speed-up-templates
- https://coder.com/docs/tutorials/template-from-scratch