terraform { required_providers { incus = { source = "lxc/incus" version = "0.3.1" } } } provider "incus" { # Configuration options generate_client_certificates = true accept_remote_certificate = true remote { name = "incus-server" default = true scheme = "https" port = "8443" address = "192.168.122.130" token = "eyJjbGllbnRfbmFtZSI6InRvZnUiLCJmaW5nZXJwcmludCI6IjE2ZWJiYTliNTZkZDA4ZWZlNGRmMjAwZTMzYmFkMGM2ZTllNDllOWRkMzgwOGI1YTYwOTM0ODJkZDM5MjZlOWIiLCJhZGRyZXNzZXMiOlsiMTkyLjE2OC4xMjIuMTMwOjg0NDMiXSwic2VjcmV0IjoiNGY3YzhhODBlNTEwMDVhMjc4NDgzNTY1YmRlZDE1NGMzNjUwNmUxNmZjMDA0MjkwZTUwMjljNTQzZjU5NGJjOCIsImV4cGlyZXNfYXQiOiIwMDAxLTAxLTAxVDAwOjAwOjAwWiJ9" } } data "template_file" "cloud-init" { template = file("${path.module}/cloud-init.yaml") } resource "incus_project" "lamp" { name = "lamp" description = "terraform - cloud-init - ansible" } resource "incus_profile" "lamp" { project = "lamp" name = "default" config = { "cloud-init.user-data" = data.template_file.cloud-init.rendered } device { type = "nic" name = "eth0" properties = { nictype = "bridged" parent = "br0" } } device { type = "disk" name = "root" properties = { pool = "default" path = "/" } } }