Comments (8)
This seems to be a problem in the upstream HCL package we use. So I reported the error there: hashicorp/hcl#268. However, this has already been reported but there was no further activity: hashicorp/hcl#233
from json2hcl.
Are these escape characters in the resulting HCL harmful and cause it to be invalid or is it just an aesthetic concern?
from json2hcl.
The resulting HCL is invalid.
from json2hcl.
I have debugged this issue a bit and, if it's a bug, it originates in Hashicorp's HCL library (https://github.com/hashicorp/hcl). Since I am not well versed in HCL on my own, could you explain to me when a double quote needs to be escaped in HCL? Only when it's not inside a ${ ... }
or never?
from json2hcl.
I'm on holiday this week and can't really test or research further as i don't have a computer. However, I cannot recall needing to escape double quotes at all in any of the HCL templates I've written.
from json2hcl.
I've similar issue with my own automated tool that generates JSON configuration.
Here is the generated configuration:
{
"resource":[
{
"bitbucket_hook":{
"bamboo":{
"events":[
"repo:push",
"pullrequest:fulfilled"
],
"url":"${format(var.bamboo_url, \"PRJ-KEY\", var.skip_branches ? \"true\" : \"false\")}",
"description":"Trigger Bamboo build: PRJ-KEY",
"owner":"${var.owner}",
"repository":"${bitbucket_repository.PRJ-KEY}"
}
}
}
]
}
This configuration is converted to:
"resource" "bitbucket_hook" "bamboo" {
"events" = ["repo:push", "pullrequest:fulfilled"]
"url" = "${format(var.bamboo_url, \"PRJ-KEY\", var.skip_branches ? \"true\" : \"false\")}"
"description" = "Trigger Bamboo build: PRJ-KEY"
"owner" = "${var.owner}"
"repository" = "${bitbucket_repository.PRJ-KEY}"
}
As you can see, the arguments for the format
function are not de-escaped. It should be this way:
"url" = "${format(var.bamboo_url, "PRJ-KEY", var.skip_branches ? "true" : "false")}"
from json2hcl.
To be honest, I don't know HCL that well. Is "${format(var.bamboo_url, \"PRJ-KEY\", var.skip_branches ? \"true\" : \"false\")}"
invalid?
from json2hcl.
Sorry, should've made that clear: yes, it's not a valid HCL.
from json2hcl.
Related Issues (17)
- reverse and back again not valid HOT 1
- Error converting nested lists HOT 1
- HCL2 support HOT 2
- Install using home brew HOT 2
- Apple Silicon M1 support HOT 2
- fatal error: runtime: bsdthread_register error HOT 9
- Latest release is missing artefacts HOT 4
- unable to parse HCL: At 2:17: Unknown token: 2:17 IDENT bool
- Json2hcl reverse is not working. HOT 2
- Wrong json output HOT 1
- library support HOT 1
- Arrays where they shouldn't be HOT 15
- json2hcl is json-esq not HCL standard HOT 1
- Support converting CloudFormation templates to Terraform HCL HOT 2
- Parsing JSON with array as root HOT 1
- Converting JSON into tf data HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json2hcl.