Skip to content

Support custom terragrunt release locations - #150

Open
fbehrens51 wants to merge 5 commits into
warrensbox:masterfrom
fbehrens51:feature/tgenv-remote
Open

Support custom terragrunt release locations#150
fbehrens51 wants to merge 5 commits into
warrensbox:masterfrom
fbehrens51:feature/tgenv-remote

Conversation

@fbehrens51

Copy link
Copy Markdown

Summary

Adds an opt-in TGENV_REMOTE environment variable that lets tgswitch fetch the version list and terragrunt binaries from a self-hosted location instead of the public GitHub releases page / warrensbox.github.io proxy list. Useful for air-gapped environments, internal mirrors, or anywhere pulling directly from GitHub isn't an option.

When unset, behavior is unchanged - same defaults as today.

Usage

export TGENV_REMOTE="https://my-endpoint.example.com/terragrunt-releases"

The endpoint must serve:

|_versions.json
|_v1.1.0/
  |_terragrunt_linux_amd64
|_v1.1.1/
  |_terragrunt_linux_amd64

Any HTTP(S)-reachable static host works (S3, GCS, an internal artifact repo, plain nginx, etc.) - tgswitch just issues normal GET requests.

A reference script, scripts/generate-remote.sh, is included to mirror a chosen set of terragrunt releases into this layout.

Changes

  • main.go: resolveRemoteURLs() resolves the release URL and version-list URL once, honoring TGENV_REMOTE when set, and threads them through installFromList/installVersion/installTGHclFile instead of relying on package-level constants.
  • scripts/generate-remote.sh: mirrors a given list of terragrunt versions into the versions.json + vX.Y.Z/ layout above.
  • README.md: documents the new env var and the reference script.
  • .gitignore: ignores the script's default output directory.

Test plan

  • go build ./..., go vet ./..., go test ./... all pass
  • Manually ran scripts/generate-remote.sh against the real terragrunt GitHub releases and confirmed the output layout and versions.json shape match what tgswitch parses
  • Confirmed default (no TGENV_REMOTE) behavior is unchanged

Set TGENV_REMOTE to a base URL (e.g. an S3 bucket) hosting a
versions.json index plus vN.N.N/terragrunt_<os>_<arch> binaries, and
tgswitch will fetch releases from there instead of the public GitHub
releases page / warrensbox version-list proxy.
The prior wording implied S3 specifically, but tgswitch just issues
plain HTTP GET requests, so any static host serving the expected file
layout works.
scripts/generate-remote.sh builds the versions.json + vX.Y.Z/ layout
TGENV_REMOTE expects, given a list of versions to mirror. It's a
reference/example, generalized from an internal CI pipeline pattern
that pulls a preset list of versions rather than discovering them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant