Terraform Provider Libvirt
dmacvicar’s libvirt provider is already in the official registry. Yet, I indend to contribute functionalities, which I would like to use in my homelab. This post is the progressive summary of the process. Development setup Set the environment: 1 2 mkdir -p ~/GitRepos mkdir -p ~/terraform.d/plugins/local-registry/cbugk/libvirt/0.7.0/linux_amd64 For installing terrraform and the initial provider test Fabian Lee’s introduction was followed. His main.tf file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 terraform { required_version = ">= 1.0.1" required_providers { libvirt = { source = "dmacvicar/libvirt" version = "0.6.10" } } } provider "libvirt" { uri = "qemu:///system" } resource "libvirt_domain" "terraform_test" { name = "terraform_test" } Compilation from source, which can be done by simply runing make. terraform-provider-libvirt binary will be output in repository’s root. For more info checkout provider’s Github repository, version 0.7.0 was used. 1 2 3 4 5 6 7 8 # Clone repository $ mkdir -p ~/GitRepos $ git clone https://github.com/dmacvicar/terraform-provider-libvirt.git $ cd terraform-provider-libvirt # Compile $ make # Move provider binary to registry $mv terraform-provider-libvirt ~/.terraform.d/plugins/local-registry/cbugk/libvirt/0.7.0/linux_amd64/ For using a local copy of provider filesystem_mirror property was set under ~/.terraformrc (file was not present). Sources: Sam Debruyn’s blog post, tnom’s SO answer, terraform docs. 1 2 $ ls -la ~/.terraform.d/plugins/local-registry/cbugk/libvirt/0.7.0/linux_amd64/terraform-provider-libvirt -rwxr-xr-x. 1 cbugk cbugk 24139069 Nov 13 09:41 /home/cbugk/.terraform.d/plugins/local-registry/cbugk/libvirt/0.7.0/linux_amd64/terraform-provider-libvirt Note that due to location ~/.terraform.d/plugins being a default implicit override directory, creating rc file is not required. However, here is the respective configuration. ~/.terraformrc modified: ...