Configuration reference¶
This page contains the field reference for incus-apply resource documents.
Common fields¶
Field |
Type |
Description |
|---|---|---|
|
string |
Required resource kind. |
|
string |
Required resource name. May include a remote prefix. |
|
map |
Resource configuration options. |
|
map |
Device configurations. |
|
string |
Resource description. |
Remotes¶
Incus supports named remote servers. By default, incus-apply targets whichever remote is configured as the default in the incus CLI.
Apply an entire run to a remote by passing the remote name with a trailing colon as the last positional argument:
incus-apply instance.yaml server-a:
Override the remote per resource by prefixing the resource name:
kind: instance
name: server-a:ubuntu
image: images:ubuntu/24.04
The per-resource prefix takes precedence over a CLI-level remote target.
Project¶
All resources are applied to an Incus project. By default, incus-apply uses the project configured for the incus CLI. Override it for a run with:
incus-apply . --project myproject
Instance fields¶
Field |
Type |
Description |
|---|---|---|
|
string |
Image to use, for example |
|
bool |
Create a VM instead of a container. |
|
bool |
Create an empty instance. |
|
bool |
Create an ephemeral instance deleted when it stops. |
|
list |
Profiles to apply. |
|
string |
Storage pool for the root disk. |
|
string |
Network to attach. |
|
string |
Cluster member target. |
|
list |
Same-project instance names that must be applied first. |
Cloud-init¶
When an instance defines config."cloud-init.vendor-data" or config."cloud-init.user-data", incus-apply waits for cloud-init to finish after creating the instance. For VMs, it first waits for the Incus agent.
Cloud-init values can be written either as a block scalar string or as an inline YAML mapping.
Block scalar form¶
config:
cloud-init.user-data: |
#cloud-config
packages:
- caddy
Inline YAML mapping form¶
config:
cloud-init.user-data:
#cloud-config
packages:
- caddy
runcmd:
- systemctl enable caddy
Complete instance example¶
kind: instance
name: web
image: images:debian/12
config:
cloud-init.user-data:
#cloud-config
package_update: true
packages:
- caddy
write_files:
- path: /etc/caddy/Caddyfile
content: |
:80 {
root * /var/www/html
file_server
}
runcmd:
- systemctl enable caddy
- systemctl restart caddy
Storage pool fields¶
Field |
Type |
Description |
|---|---|---|
|
string |
Storage driver such as |
|
string |
Source path or device. |
Storage volume and bucket fields¶
Field |
Type |
Description |
|---|---|---|
|
string |
Required storage pool name. |
|
string |
Storage content type passed as |
Storage bucket key fields¶
Storage bucket keys are S3 credentials that grant access to a storage bucket.
Field |
Type |
Description |
|---|---|---|
|
string |
Required storage pool name. |
|
string |
Required parent bucket name. |
|
string |
|
---
kind: storage-bucket
name: assets
pool: default
config:
size: 10GiB
description: S3-compatible object storage bucket
---
kind: storage-bucket-key
name: app-key
bucket: assets
pool: default
role: read-only
description: Read-only S3 credentials for the application
To use storage buckets on local storage pools such as dir, btrfs, lvm, or zfs, configure an S3 listen address first:
incus config set core.storage_buckets_address :8555
Network fields¶
Field |
Type |
Description |
|---|---|---|
|
string |
Network type, such as |
Network forward fields¶
For kind: network-forward, listen_address is the external address and network selects the parent network.
Field |
Type |
Description |
|---|---|---|
|
string |
Required external listen address. |
|
string |
Required parent network name. |
|
list |
Optional port forwarding rules in the same shape as |
Use config.target_address to define the default target for unmatched traffic.
kind: network-forward
listen_address: 198.51.100.10
network: public
description: Shared external IP for web services
config:
target_address: 10.42.0.10
ports:
- protocol: tcp
listen_port: "80"
target_address: 10.42.0.11
target_port: "8080"
- protocol: tcp
listen_port: "443"
target_address: 10.42.0.12
target_port: "8443"
Network ACL fields¶
Field |
Type |
Description |
|---|---|---|
|
list |
Ingress firewall rules. |
|
list |
Egress firewall rules. |
Variables¶
Variables are declared with a kind: vars document and referenced from resource documents with $VAR or ${VAR}.
---
kind: vars
vars:
DB_NAME: myapp
DB_USER: appuser
DB_PASS: ${MYSQL_PASSWORD}
---
kind: instance
name: db
image: docker:mysql
config:
environment.MYSQL_DATABASE: $DB_NAME
environment.MYSQL_USER: $DB_USER
environment.MYSQL_PASSWORD: $DB_PASS
Scoping¶
Variables are file-scoped by default.
Use
global: truein avarsdocument to share variables across files.File-scoped variables override global variables with the same name.
Shell environment¶
Shell environment variables can be referenced only inside the
varsdocument.Resource documents expand only variables declared through
kind: vars.