LXD Resource provider for Terraform
This provider is published in the Terraform Registry.
Follow the official instructions for declaring providers in your Terraform configuration here.
Add the following to your Terraform configuration:
terraform {
required_providers {
lxd = {
source = "terraform-lxd/lxd"
}
}
}
- Follow these instructions to setup a Golang development environment.
- Checkout the repository
git clone ...
- Compile from sources to a development binary:
cd terraform-provider-lxd
go build -v
- Configure Terraform (
~/.terraformrc
) to use the development binary provider:
$ cat ~/.terraformrc
provider_installation {
dev_overrides {
"terraform-lxd/lxd" = "/home/<REPLACE_ME>/git/terraform-provider-lxd"
}
}
There are two test suites, unit and acceptance. By default the acceptance tests are not run as they require a functional LXD environment.
make
make acc
# or run an individual test
TESTARGS="-run TestAccCachedImage_basicVM" make testacc
# increase test verbosity. options are trace, debug, info, warn, or error (default)
TF_LOG=info make testacc
Full documentation can be found in the docs
directory.
Many of the base LXD images don't include an SSH server, therefore terraform
will be unable to execute any provisioners
. Either use the base ubuntu images
from the ubuntu
or ubuntu-daily
or manually prepare a base image that
includes SSH.
Some recognition for great contributors to this project: