I have issues with setting static ip using cloud init.
My incus server is as simple as it can get and runs on a raspberry pi 5.
Using the attached terraform file things pretty much works as it should but I can not get a static ip on the eth1 interface.
Everything else in cloud-init works and I have tried with version 1 of the network config, version 2 and various matches on eth1 and so on.
What am I missing / doing wrong?
Can anyone please give me a hint. Some have had issues with older debian images but I can’t find anything on bookworm.
main.tf
terraform {
required_providers {
incus = {
source = "lxc/incus"
}
}
}
provider "incus" {
// Configuration for the Incus provider
}
resource "incus_network" "private" {
name = "private"
config = {
"ipv4.address" = "192.168.170.1/24"
"ipv4.nat" = "true"
"ipv4.dhcp" = "false"
"ipv6.dhcp" = "false"
}
}
resource "incus_profile" "private_profile" {
name = "private_profile"
device {
name = "eth1"
type = "nic"
properties = {
nictype = "bridged"
parent = "${incus_network.private.name}"
}
}
device {
type = "disk"
name = "root"
properties = {
pool = "default"
path = "/"
}
}
}
resource "incus_instance" "testserver" {
name = "testserver"
image = "images:debian/12/cloud"
profiles = ["default", "${incus_profile.private_profile.name}"]
config = {
"boot.autostart" = true
"user.user-data" = <<-EOT
#cloud-config
timezone: Europe/Stockholm
package_update: true
package_upgrade: true
packages:
- openssh-server
- sudo
network:
version: 2
ethernets:
eth0:
dhcp4: true
dhcp6: true
eth1:
dhcp4: false
dhcp6: false
addresses:
- 192.168.170.50/24
gateway4: 192.168.170.1
EOT
}
limits = {
cpu = 2
}
}