Hi maintainers, thanks for your work on python-hcl2.
Environment:
python-hcl2: 8.1.0
Last known working version: 7.3.1
Summary:
After upgrading to 8.1.0, parsing/serialization appears to preserve quote characters in a way that changes value types. In our Terraform tfvars JSON output, null values become the string "null", which then breaks Terraform type validation.
Observed error:
Error: Region is not valid: "us-east-1"
And during Terraform plan:
Error: Invalid value for input variable
a number is required
Problematic generated values:
ecs_autoscaling_replicas: "null"
ecs_autoscaling_target_cpu_utilization: "null"
ecs_autoscaling_target_ram_utilization: "null"
Expected behavior:
These values should remain null (JSON null), not "null" (string), so Terraform can treat them as nullable numeric inputs.
Compatibility attempt:
We tried the migration-guide compatibility options:
V7_COMPAT = SerializationOptions(
strip_string_quotes=True,
explicit_blocks=False,
with_comments=False,
)
With these options, the null-to-"null" issue still occurs.
Impact:
Terraform planning fails because variables expecting numbers receive strings.
Request:
Could you please confirm whether this is a known regression in 8.1.0 and advise on a workaround? Happy to provide a minimal reproducer if needed.
Thanks a lot.
Hi maintainers, thanks for your work on python-hcl2.
Environment:
python-hcl2: 8.1.0
Last known working version: 7.3.1
Summary:
After upgrading to 8.1.0, parsing/serialization appears to preserve quote characters in a way that changes value types. In our Terraform tfvars JSON output, null values become the string "null", which then breaks Terraform type validation.
Observed error:
Error: Region is not valid: "us-east-1"
And during Terraform plan:
Error: Invalid value for input variable
a number is required
Problematic generated values:
ecs_autoscaling_replicas: "null"
ecs_autoscaling_target_cpu_utilization: "null"
ecs_autoscaling_target_ram_utilization: "null"
Expected behavior:
These values should remain null (JSON null), not "null" (string), so Terraform can treat them as nullable numeric inputs.
Compatibility attempt:
We tried the migration-guide compatibility options:
With these options, the null-to-"null" issue still occurs.
Impact:
Terraform planning fails because variables expecting numbers receive strings.
Request:
Could you please confirm whether this is a known regression in 8.1.0 and advise on a workaround? Happy to provide a minimal reproducer if needed.
Thanks a lot.