Reader small image

You're reading from  HashiCorp Packer in Production

Product typeBook
Published inJul 2023
PublisherPackt
ISBN-139781803246857
Edition1st Edition
Right arrow
Author (1)
John Boero
John Boero
author image
John Boero

John Boero has 20 years of experience in the tech industry covering engineering, consulting, architecture, and pre-sales. He comes from Chicago, IL in the USA but currently lives in London, UK. He has worked for Red Hat, Puppet, and HashiCorp and remains active in the open source community. All commissions for this book will be donated to the Raspberry Pi Foundation non-profit to encourage coding and computing skills for kids.
Read more about John Boero

Right arrow

Using an IDE to guide templates

What would a JSON version of our first template look like? JSON is important because a lot of source material from the community and GitHub is still written in legacy JSON. In fact, JSON has some advantages and disadvantages, so you may want to start with JSON when writing your template and convert it to HCL later. There is no tool within Packer to convert HCL2 to pkr.json or legacy JSON, so when a JSON option is required, it’s best to start with pkr.json syntax and not legacy JSON. Only legacy JSON to HCL2 templates can be migrated with Packer’s built-in tool. This can be installed from GitHub or via the go command:

go install github.com/hashicorp/hcl/v2/cmd/hcldec@latest

Schemas are very helpful when building JSON templates. A JSON schema is simply a specialized JSON document that declares the desired format of another JSON document. Schemas are not available from the Packer engineering team, but Community versions are available...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
HashiCorp Packer in Production
Published in: Jul 2023Publisher: PacktISBN-13: 9781803246857

Author (1)

author image
John Boero

John Boero has 20 years of experience in the tech industry covering engineering, consulting, architecture, and pre-sales. He comes from Chicago, IL in the USA but currently lives in London, UK. He has worked for Red Hat, Puppet, and HashiCorp and remains active in the open source community. All commissions for this book will be donated to the Raspberry Pi Foundation non-profit to encourage coding and computing skills for kids.
Read more about John Boero