Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions hcl2/reconstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,12 @@ def _transform_value_to_expr_term(self, value, level) -> Union[Token, Tree]:
)
return Tree(Token("RULE", "expr_term"), [tuple_tree])

if value is None:
return Tree(
Token("RULE", "expr_term"),
[Tree(Token("RULE", "identifier"), [Token("NAME", "null")])],
)

# for dicts, recursively turn the child k/v pairs into object elements
# and store within an object
if isinstance(value, dict):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
{
"terraform": {
"channels": "${local.running_in_ci ? local.ci_channels : local.local_channels}",
"authentication": []
"authentication": [],
"foo": null
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ locals {
terraform = {
channels = (local.running_in_ci ? local.ci_channels : local.local_channels),
authentication = [],
foo = null,
}
}
1 change: 1 addition & 0 deletions test/unit/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def test_locals_embdedded_condition_tf(self):
terraform={
"channels": "${local.running_in_ci ? local.ci_channels : local.local_channels}",
"authentication": [],
"foo": None,
},
)

Expand Down