Repository navigation
fix: keep '=' in env var values passed to terragrunt get_env - #2757
Open
sarankumar1325 wants to merge 1 commit into
Open
sarankumar1325 wants to merge 1 commit into
sarankumar1325 wants to merge 1 commit into
Conversation
getEnvs split each os.Environ entry on every '=' and kept only the second piece, so a value such as "token=abc==" reached terragrunt's get_env as "token". Split on the first '=' only.
This branch has not been deployed
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
getEnvs()inlibs/digger_config/terragrunt/tac/generate.gobuilds theEnvmap that is handed to terragrunt's options when Digger generates projects from terragrunt configs. It split eachos.Environ()entry withstrings.Split(env, "=")and stored onlyresults[1], so any value that itself contains=was cut at the first=in the value:get_env("FOO")in a terragrunt file evaluated through that options object then saw the truncated value (base64 padding, URLs with query strings,k=vlists are common examples).This change splits on the first
=only (strings.Cut), which is how the environment is defined, and skips entries without one instead of indexing past the slice.Tests
TestGetEnvsKeepsEqualsInValues(fails ondevelopwithtokenvstoken=abc==, passes with the fix).GOWORK=off go test ./digger_config/...inlibs/passes;go vetclean.🧠 Ai UsageDetails (if applicable):
This PR was written with AI assistance (Grok Bot): it found the bug, wrote the fix and test, and ran the tests. I reviewed the change.