/terraform-provider-lxd

LXD Resource provider for Terraform

Primary LanguageGoMozilla Public License 2.0MPL-2.0

terraform-provider-lxd

LXD Resource provider for Terraform

Prerequisites

Installation

This provider is published in the Terraform Registry.

Follow the official instructions for declaring providers in your Terraform configuration here.

Quick Example

Add the following to your Terraform configuration:

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

Development

Setup

  1. Follow these instructions to setup a Golang development environment.
  2. Checkout the repository git clone ...
  3. Compile from sources to a development binary:
cd terraform-provider-lxd
go build -v
  1. Configure Terraform (~/.terraformrc) to use the development binary provider:
$ cat ~/.terraformrc
provider_installation {
  # Use local git clone of LXD provider
  dev_overrides {
    "terraform-lxd/lxd" = "/home/<REPLACE_ME>/git/terraform-provider-lxd"
  }

  # For all other providers, install them directly from their origin provider
  # registries as normal. If you omit this, Terraform will _only_ use
  # the dev_overrides block, and so no other providers will be available.
  direct {}
}

Testing

There are two test suites, unit and acceptance. By default the acceptance tests are not run as they require a functional LXD environment.

Unit tests
make
Acceptance tests
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

Documentation

Full documentation can be found in the docs directory.

Contributors

Some recognition for great contributors to this project: