Skip to content
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

hclwrite: add support for tuple,nested object and function call #502

Merged
merged 1 commit into from Jan 4, 2022

Commits on Jan 4, 2022

  1. hclwrite: Various new "TokensFor..." functions

    The "TokensFor..." family of functions all aim to construct valid
    raw token sequences representing particular syntax constructs.
    
    Previously we had only "leaf" functions TokensForValue and
    TokensForTraversal, but nothing to help with constructing compound
    structures.
    
    Here we add TokensForTuple, TokensForObject, and
    TokensForFunctionCall which together cover all of the constructs
    that HCL allows static analysis of, and thus constructs where it's
    likely that someone would want to generate an expression that
    is interpreted purely by its syntax and not resolved into a value.
    
    What all of these have in common is that they take other Tokens
    values as arguments and include them verbatim as part of their
    result, with the caller being responsible for making sure these
    smaller units are themselves valid expression tokens.
    
    This also adds TokensForIdentifier as a convenient shorthand for
    generating single-identifier tokens, which is particularly useful
    for populating the attribute names in TokensForObject.
    incubator4 authored and apparentlymart committed Jan 4, 2022
    Copy the full SHA
    962b970 View commit details
    Browse the repository at this point in the history