-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
Return error when the template's single interpolation results in null value #36658
Conversation
@@ -0,0 +1,5 @@ | |||
kind: BUG FIXES | |||
body: Return error when the template's single interpolation results in null value |
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.
Could you please update the change file to mention the templatestring
function?
Changelog WarningCurrently this PR would target a v1.11 release. Please add a changelog entry for in the .changes/v1.11 folder, or discuss which release you'd like to target with your reviewer. If you believe this change does not need a changelog entry, please add the 'no-changelog-needed' label. |
Heads up, the changelog for this change has ended up in the wrong folder and wrong branch. Since it was backported to 1.11, there should only be a changelog file on the v1.11 branch in the .changes/1.11 directory. None on main |
Thanks @dbanck. I'll move appropriately |
Fixes #36652
When a string interpolation contains only one expression sequence, HCL optimizes by wrapping and directly delegating evaluation to that expression. The
templatestring
function tries to refine the expression value as non-null, and if null, this refinement leads to a panic. For compatibility reasons, HCL has to continue to support this unwrapping logic (See attempted PR), thus we will simply return an error intemplatestring
when the single evaluated expression is nullTarget Release
1.12.x
CHANGELOG entry