-
Notifications
You must be signed in to change notification settings - Fork 875
feat(provisioner/terraform/tfparse): add support for built-in Terraform functions #16183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo a confusing comment
// We cannot support all available functions here, as the result of reading a file will be different | ||
// depending on the execution environment. | ||
safeFunctions = map[string]function.Function{ | ||
"abs": stdlib.AbsoluteFunc, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Post-merge thought: how do we align Terraform versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I could tell it doesn't look like these functions change all that often.
However, f Terraform adds a new function in future, we'll need to add support for it ourselves. Then again, so will aquasec/trivy-iac
. This is an unfortunate consequence of Terraform having made the bulk of their internal functions un-importable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I think we're fine here and we can just update the lib.
My only concern is if they change the semantics of the functions between versions, but I doubt they'd do that.
Relates to #15977
Adds support for some functions in
tfparse
(only functions that do not reference local files).NOTE: for now, I'm importing trivy-iac. If we prefer to avoid a little dependency, I can do a little copying instead.