Skip to content

HCL Parser Fails with Valid Object Declarations and Heredoc Strings #7736

@BrentSouza

Description

@BrentSouza

Team

  • I've assigned a team label to this issue

Severity

High

Version

1.0.4

Latest Version

No response

What happened?

Two problems with the HCLParser that cause failures in valid HCL:

  1. Comments in object type declarations:
variable "foo" {
  type = object({
    # this prop is really important for reasons
    bar = string
    # this one...who knows
    baz = string
}
  1. Heredoc delimiters match in the middle of a string:
variable "bar" {
  default = <<-EOF
  Here we have some text. And for valid reasons,
  I need to have EOF in the text I'm writing.
  EOF

The parser currently matches the EOF in the middle of the sentence and then fails with invalid syntax for the remainder.

Reproduction

See above.

Error and Stacktrace

No response

More Information

No response

Workaround

I've submitted a PR that seems to resolve both issues: OctopusDeploy/HCLParser#11

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugThis issue represents a verified problem we are committed to solving

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions