Jump to content

User:BryanDavis/Tofu

From Wikitech

OpenTofu tips and tricks

Local override of provider

This works for me in my gitlab:cloudvps-repos/deployment-prep/tofu-provisioning working copy. It is also ugly and horrible, but I'm not sufficiently motivated yet to figure out a new way.

This repo has a gitignore for .terraform, so I will use that directory to hold the goodies I want to add to the config. The git working copy is mounted into the make shell managed runtime container at /srv/app.

bd808@laptop:~/tofu-provisioning$ mkdir -p .terraform/tofu-cloudvps
bd808@laptop:~/tofu-provisioning$ cp ~/projects/wmf/cloud/cloud-vps/tofu-cloudvps/out/* .terraform/tofu-cloudvps/
.terraform/terraform.rc
provider_installation {
  dev_overrides {
    "tofu.wmcloud.org/registry/cloudvps" = "/srv/app/.terraform/tofu-cloudvps"
  }
  direct {}
}
.env
# Config overrides for testing plugins, etc
TF_CLI_CONFIG_FILE=/srv/app/.terraform/terraform.rc
bd808@laptop:~/tofu-provisioning$ make shell
🖥️ Entering Docker container...
somebody@deployer:/srv/app$ TF_LOG=DEBUG tofu version 2>&1 | grep dev_overrides
2026-09-01T18:09:33.015Z [DEBUG] Provider tofu.wmcloud.org/registry/cloudvps is overridden by dev_overrides

See also: https://tenthirtyam.org/dispatches/2026/03/25/using-dev_overrides-for-local-terraform-provider-development/