-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Labels
bugSomething isn't workingSomething isn't working
Description
When deserializing a property that assigns the literal value string to a property, it is incorrectly quoted.
A clear and concise description of what the bug is.
Software:
- OS: Linux
- Python version 3.11
- python-hcl2 version 7.3.1
Snippet of HCL2 code causing the unexpected behaviour:
variable "octopus_space_id" {
type = string
nullable = false
sensitive = false
description = "The ID of the Octopus space to populate."
}Expected behavior
The following script should produce output with an unquoted string value:
import hcl2
hcl = """variable "octopus_space_id" {
type = string
nullable = false
sensitive = false
description = "The ID of the Octopus space to populate."
}
"""
parsed_config = hcl2.loads(hcl, with_meta=True)
example_ast = hcl2.reverse_transform(parsed_config)
converted_hcl = hcl2.writes(example_ast)
print(converted_hcl)The result of this script is this:
variable "octopus_space_id" {
type = "string"
nullable = false
sensitive = false
description = "The ID of the Octopus space to populate."
}
Terraform does not accept this output as the type must be an unquoted value.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working