Repository: amplify-education/python-hcl2

Issue:
Error when using "reverse_transform" with a variable with value "None"
python-hcl2 version: 6.1.1
python version: 3.10.12

When using the `hcl2.reverse_transform()` with a dictionary where an item has "None" I get the following error:
```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/dist-packages/hcl2/api.py", line 69, in reverse_transform
    return hcl2_reverse_transformer.transform(hcl2_dict)
  File "/usr/local/lib/python3.10/dist-packages/hcl2/reconstructor.py", line 371, in transform
    body = self._transform_dict_to_body(hcl_dict, level)
  File "/usr/local/lib/python3.10/dist-packages/hcl2/reconstructor.py", line 509, in _transform_dict_to_body
    expr_term = self._transform_value_to_expr_term(value, level)
  File "/usr/local/lib/python3.10/dist-packages/hcl2/reconstructor.py", line 565, in _transform_value_to_expr_term
    value_expr_term = self._transform_value_to_expr_term(dict_v, level + 1)
  File "/usr/local/lib/python3.10/dist-packages/hcl2/reconstructor.py", line 643, in _transform_value_to_expr_term
    raise RuntimeError(f"Unknown type to transform {type(value)}")
RuntimeError: Unknown type to transform <class 'NoneType'>
```

I create a bit of code to easily test/reproduce:
**test.tfvar**
```terraform
test = {
  nulltest = null
}
```
**test.py**
```python
import os
import hcl2

with open("test.tfvar, "r") as file:
    tfvar= hcl2.load(file, with_meta=True)
print(tfvar)

transform = hcl2.reverse_transform(tfvar)
output= hcl2.writes(transform)
print(output)
```

output of `print(tfvar)`
```
{'test': {'nulltest': None}}
```

I would expect the output of `print(output)` to be the same as the test.tfvar. But instead I get the error mentioned above.
One I add double quotes around the null it works without any problem.

so I think the parsing of the "None" value isn't working correctly (or i'm doing something wrong ofc)

Hints from issue comments:

Solution patch:
diff --git a/hcl2/reconstructor.py b/hcl2/reconstructor.py
index 609a7cc..d36aa26 100644
--- a/hcl2/reconstructor.py
+++ b/hcl2/reconstructor.py
@@ -540,6 +540,12 @@ class HCLReverseTransformer:
             )
             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):


Test patch:
diff --git a/test/helpers/terraform-config-json/locals_embedded_condition.json b/test/helpers/terraform-config-json/locals_embedded_condition.json
index 5707e56..d8567d1 100644
--- a/test/helpers/terraform-config-json/locals_embedded_condition.json
+++ b/test/helpers/terraform-config-json/locals_embedded_condition.json
@@ -3,7 +3,8 @@
     {
       "terraform": {
         "channels": "${local.running_in_ci ? local.ci_channels : local.local_channels}",
-        "authentication": []
+        "authentication": [],
+        "foo": null
       }
     }
   ]
diff --git a/test/helpers/terraform-config/locals_embedded_condition.tf b/test/helpers/terraform-config/locals_embedded_condition.tf
index be718f5..621adfc 100644
--- a/test/helpers/terraform-config/locals_embedded_condition.tf
+++ b/test/helpers/terraform-config/locals_embedded_condition.tf
@@ -2,5 +2,6 @@ locals {
   terraform = {
     channels = (local.running_in_ci ? local.ci_channels : local.local_channels),
     authentication = [],
+    foo = null,
   }
 }
diff --git a/test/unit/test_builder.py b/test/unit/test_builder.py
index 9ac343a..419522c 100644
--- a/test/unit/test_builder.py
+++ b/test/unit/test_builder.py
@@ -44,6 +44,7 @@ class TestBuilder(TestCase):
             terraform={
                 "channels": "${local.running_in_ci ? local.ci_channels : local.local_channels}",
                 "authentication": [],
+                "foo": None,
             },
         )