mattolenik/hclq

[Bug] missing quote in get with raw flag

caongocthai opened this issue · 0 comments

Create simple hcl file example.tf:

data "foo" {
  "bar" = "        - \"one\"\n        - \"-two\"\n        - \"three\""
}

Run: cat example.tf | hclq get --raw 'data.foo.bar'

Expect:

        - "one"
        - "-two"
        - "three"

Get:

        - "one"
        - "-two"
        - "three    <- missing the last double quote here 

This 2 scenarios would work fine without problem:

data "foo" {
  "bar" = "        - \"one\"\n        - \"-two\"\n        - \"three\"\n"  <- add a new line \n at the end here
}

or

data "foo" {
  "bar" = "        - 'one'\n        - '-two'\n        - 'three'"  <- use single quote ' instead of escape double quotes \"
}