Support custom terragrunt release locations - #150
Open
fbehrens51 wants to merge 5 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in
TGENV_REMOTEenvironment variable that letstgswitchfetch the version list and terragrunt binaries from a self-hosted location instead of the public GitHub releases page /warrensbox.github.ioproxy 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
The endpoint must serve:
Any HTTP(S)-reachable static host works (S3, GCS, an internal artifact repo, plain nginx, etc.) -
tgswitchjust 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, honoringTGENV_REMOTEwhen set, and threads them throughinstallFromList/installVersion/installTGHclFileinstead of relying on package-level constants.scripts/generate-remote.sh: mirrors a given list of terragrunt versions into theversions.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 passscripts/generate-remote.shagainst the real terragrunt GitHub releases and confirmed the output layout andversions.jsonshape match whattgswitchparsesTGENV_REMOTE) behavior is unchanged