feat: terraform variables added to input#165
Merged
Merged
Conversation
Input can override template vars, implementing the equivalent of '-var' in terraform.
aa4c103 to
b1e7015
Compare
aslilac
approved these changes
Jul 11, 2025
Comment on lines
+49
to
+63
| // Intentionally commented out to avoid loading from host environment | ||
| // | ||
| //for _, env := range os.Environ() { | ||
| // split := strings.Split(env, "=") | ||
| // key := split[0] | ||
| // if !strings.HasPrefix(key, "TF_VAR_") { | ||
| // continue | ||
| // } | ||
| // key = strings.TrimPrefix(key, "TF_VAR_") | ||
| // var val string | ||
| // if len(split) > 1 { | ||
| // val = split[1] | ||
| // } | ||
| // combinedVars[key] = cty.StringVal(val) | ||
| //} |
Member
There was a problem hiding this comment.
hmm. feels a bit weird to leave this code, but it is also nice to have the comment noting that it's explicitly not a desired behavior.
maybe we leave the comment but remove the actual code? it's not a big deal either way tho
Member
Author
There was a problem hiding this comment.
Yea, I was a bit unsure. If someone was to reference the original source, they might assume this piece of code was accidentally omitted, or should be added.
I'll remove the code, and just add in a longer comment to describe it better.
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.
Input can override template vars, implementing the equivalent of '-var' in terraform.
To make this work, the
*.tfvarfiles have to be manually parsed. Trivy takes either a set of variable values XOR a set of tfvar files. This code reads the variable values from the files, then overrides with any user supplied values.