feat: add Terraform/OpenTofu registry remote type #45

Merged
benvin merged 1 commits from feat/terraform-registry-remote into master 2026-06-06 23:51:52 +10:00
Owner

Summary

  • New terraform package type implementing the Terraform Registry Protocol
  • construct_url prepends /v1/providers/ so paths like hashicorp/vault/versions map to registry.terraform.io/v1/providers/hashicorp/vault/versions
  • resolve_content rewrites download_url, shasums_url, and shasums_signature_url in per-version download info JSON to route through a companion releases_remote (generic remote proxying releases.hashicorp.com)
  • Built-in mutable pattern for {namespace}/{type}/versions — version lists expire and are re-fetched; per-version download info is immutable
  • Client configuration via .terraformrc / .tofurc host block — no changes to .tf provider source addresses needed

Test plan

  • 8 unit tests covering mutable detection, URL rewriting, binary pass-through, construct_url correctness, and cache miss behaviour
  • End-to-end: OpenTofu 1.10.3 pulling hashicorp/vault v4.5.0 through docker-compose stack — tofu init succeeded, provider installed and signed
  • Verified download_url / shasums_url rewritten to hashicorp-releases proxy in cached response
  • All 339 tests pass
## Summary - New `terraform` package type implementing the [Terraform Registry Protocol](https://developer.hashicorp.com/terraform/internals/provider-registry-protocol) - `construct_url` prepends `/v1/providers/` so paths like `hashicorp/vault/versions` map to `registry.terraform.io/v1/providers/hashicorp/vault/versions` - `resolve_content` rewrites `download_url`, `shasums_url`, and `shasums_signature_url` in per-version download info JSON to route through a companion `releases_remote` (generic remote proxying `releases.hashicorp.com`) - Built-in mutable pattern for `{namespace}/{type}/versions` — version lists expire and are re-fetched; per-version download info is immutable - Client configuration via `.terraformrc` / `.tofurc` host block — no changes to `.tf` provider source addresses needed ## Test plan - [x] 8 unit tests covering mutable detection, URL rewriting, binary pass-through, `construct_url` correctness, and cache miss behaviour - [x] End-to-end: OpenTofu 1.10.3 pulling `hashicorp/vault v4.5.0` through docker-compose stack — `tofu init` succeeded, provider installed and signed - [x] Verified `download_url` / `shasums_url` rewritten to `hashicorp-releases` proxy in cached response - [x] All 339 tests pass
unkinben added 1 commit 2026-05-17 11:26:10 +10:00
feat: add Terraform/OpenTofu registry remote type (#45)
ci/woodpecker/pr/pre-commit Pipeline failed
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
8fc9b179a6
Implements the Terraform Registry Protocol as a proxy remote type so
Terraform and OpenTofu can pull providers through the caching layer
without changing provider source addresses.

- New `terraform` package type with `construct_url` (prepends
  `/v1/providers/`) and `resolve_content` (rewrites `download_url`,
  `shasums_url`, `shasums_signature_url` to route through a companion
  `releases_remote`)
- Built-in mutable pattern for provider version lists
  (`{ns}/{type}/versions`)
- `releases_remote` config option links the registry remote to a
  separate generic remote proxying the release CDN
- Client config: `.terraformrc` / `.tofurc` host block redirects
  `registry.terraform.io` to the proxy without touching `.tf` files
- 8 unit tests + end-to-end test (OpenTofu 1.10 pulling hashicorp/vault
  4.5.0 through docker-compose stack)
- Example config and README section added
unkinben force-pushed feat/terraform-registry-remote from 8fc9b179a6 to 43927a7666 2026-05-17 11:31:06 +10:00 Compare
benvin merged commit 99cc71f56c into master 2026-06-06 23:51:52 +10:00
benvin deleted branch feat/terraform-registry-remote 2026-06-06 23:51:53 +10:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unkin/artifactapi#45