Homelab infrastructure deployed with terraform
- documentation: Documentation for the infrastructure
- settings: global settings used for the infrastructure.
- ansible: playbooks used as tools. See their headers for info on what they do.
- terraform: terraform modules.
- Ensure terraform and SOPS are installed. SOPS secret must also be set.
terraform init
to download required modules- get old
terraform.tfstate
or import objects terraform apply
to apply changes
- Edit $HOME/.terraformrc
- Add dev_overrides there to create dev aliases for used providers to point to the local build folder:
provider_installation { dev_overrides { "Foltik/vyoS" = "/root/terraform-provider-vyos" "goauthentik/authentik" = "/root/terraform-provider-authentik" "DNSMadeEasy/dme" = "/root/go/bin" } direct {} }
- Start terraform plugin in debug mode:
<BINARY> -debug
.- provider must support debugging: see SDK instructions
- in Visual Code the following block might be used under
<provider source code>/.vscode/launch.json
:{ "version": "0.2.0", "configurations": [ { "name": "Debug Terraform Provider", "type": "go", "request": "launch", "mode": "debug", // this assumes your workspace is the root of the repo "program": "${workspaceFolder}", "env": {}, "args": [ "-debug", ] } ] }
- Follow the instructions to run terraform using the debugged provider. Usually
TF_REATTACH_PROVIDERS={...} terraform apply