Sending HCL payload in Nomad REST APIs

490 views
Skip to first unread message

Manish Kumar

unread,
Aug 6, 2019, 2:59:16 PM8/6/19
to Nomad
hey guys! 

We have Nomad jobs in HCL format, now we want to use REST API to schedule the jobs, and of course REST API will return the error as payload isn't in JSON. Having said that, writing job files in JSON isn't as easy/readable as HCL, and we want to continue using HCL when we write our job. We could use "nomad job run -output my-job.nomad" to convert HCL to JSON as part of our pipeline, but we are wondering what other approach people are using in the community?

Also, are there any specific reasons Nomad didn't support HCL payload over REST/HTTP API? I totally get that REST is supposed to be JSON but who cares, if we have a custom language(HCL) then we could support it over HTTP in Nomad REST API as well (we could call it something else than REST).

~Manish

Andrew Ward

unread,
Aug 6, 2019, 3:32:47 PM8/6/19
to Manish Kumar, Nomad
Our deployment tool uses the jobs/parse endpoint(https://www.nomadproject.io/api/jobs.html#parse-job), runs some validations on the resulting JSON, and then it submits the job in JSON format.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/nomad/issues
IRC: #nomad-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Nomad" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nomad-tool+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nomad-tool/d8a708fc-79de-416c-a5b4-9b11f786783b%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages