feat(emitter): add support for HCL expression AST nodes in module calls#5
Merged
feat(emitter): add support for HCL expression AST nodes in module calls#5
Conversation
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.
This pull request adds support for setting Terraform module input variables using HCL AST expressions, enabling more flexible and accurate emission of complex, multi-line HCL values. It introduces a new overload for
ModuleCallBuilder.Setthat accepts anHclExpression, updates the HCL emission logic to handle multi-line values with correct indentation, and exposes a utility for emitting any HCL expression as a canonical string. Comprehensive tests and documentation are included to demonstrate and validate these new capabilities.Core API Enhancements:
Set(string name, HclExpression expression)toModuleCallBuilder, allowing variables to be set using HCL AST nodes for complex or multi-line values. [1] [2]ModuleCallEmitter.EmitExpression(HclExpression expression)to emit any HCL AST node as a canonical HCL string. [1] [2]HCL Emission Improvements:
Testing:
Set(HclExpression)overload and for theEmitExpressionmethod, covering variable references, function calls, literals, objects, tuples, for-expressions, and multi-line formatting. [1] [2]Documentation:
terraformdotnet.mdto describe the new features, including usage examples and explanations for setting variables from HCL AST expressions and emitting expressions standalone.