I did a little bit more testing with OpenTofu today. This time with LXD. There was a new alpha version of OpenTofu released to fix a bug so I installed that one to keep current. I didn’t encounter the bug although I did use the sensitive variable tag.

An init, plan, apply and destroy loop worked flawlessly with the following simple LXD configuration:

terraform {
        required_providers {
    lxd = {
        source = "terraform-lxd/lxd"
    }
  }
}

resource "lxd_instance" "tofu1" {
  name = "tofu1"
  image = "ubuntu:22.04"
  ephemeral = false
  profiles = ["default"]
}

I might extend this a little bit to try some cloud-init scripts and see how that works out.