Terraform Modules to generate LXD infrastructure
Since the Terraform state needs to be potentially shared among multiple members, we are using Terraform Cloud to keep everyone in sync. Follow the instructions here to set it up yourself. Note that we might consider migrating this to a remote backend in the future.
You also need to make sure your LXD socket is exposed to the network. Relevant configuration should be applied inside the main.tf
in order to succefully authenticate with the remote LXD server.
Currently only network
, project
, profile
, container/vm
LXD features are supportes, but others can be easily added.
For instance specific configuration have a look at cloud-init.yml
and configure it for your own need. You can find more information about cloud-init here.
Make sure you change ssh_import_id
parameter, otherwise I can potentially access you VM, if the instance is publicly accesible.
Both admin public key and password-based authentication is enabled.
To replace the value of hashed_passwrd, generate a password yourself using e.g.:
mkpasswd --method=SHA-512
Once you're satisfied with your configuration, you can run:
terraform apply
This will run GitHub Actions
to verify your configuration and deploy it to Terraform Cloud you've setup that should further deploy the resources on to your infrastructure.
If you Terraform script is using cloud-init
, you need to make sure configured image in config.example.tfvars
has it included. Here you can find the available distributions.
Hint: Look for images that have /cloud
appended at the end of the name.
This repo is using pre-commit hook to run terraform fmt
which enforces Terraform best practices and prevents merging misformatted configuration.
In order to use it, run:
git config core.hooksPath .githooks
This is under active development