From the course: Learning HashiCorp Packer
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Validate Packer templates - Packer Tutorial
From the course: Learning HashiCorp Packer
Validate Packer templates
- [Instructor] As we're going to be running Packer in a CI pipeline, I'm going to take advantage of the validate command. Validate performs basic syntax and configuration checks. It's a good idea to validate a template after each change. It'll return a non-zero result if it fails, to it's perfect for incorporating into a CI process. It means that we can quickly validate the change or pool request, before continuing down the very long process of building a template, only for it to fail. So if I take the template from the previous video, where I was building Jenkins, I can type packer validate, and the template name. And it validated successfully, which I would expect, as we've just built it. But it will also check to see if we've got all the variables we need. So if I had a dummy variable in here, set it to null, and then run the packer validate again, it will throw an error and say this template doesn't validate, because we haven't provided all the variables. So we can use the var…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.