Configuring HCP Packer in your templates
HCP Packer support is actually implemented within the plugin repositories. For the sample code in this chapter, we will use the Amazon plugin to build a family of EC2 AMIs. Be sure you have the latest versions of the plugin available, as not all features are supported by older releases. Updating your local Packer plugins for a template is simple:
$ packer init –upgrade [template/directory]
HCP credentials can and should be defined in environment variables. They can be defined in your Packer template code, but remember that defining sensitive credentials in your code is usually step one to accidentally publishing them to shared or public Git repositories and being compromised. These values can be found by checking the URL bar within HCP – for example, https://portal.cloud.hashicorp.com/orgs/11eb5efd-82bd-18c1-a21f-0242ac11070b/projects/7a4e3521-d454-4c8f-8283-2ea9f9f42b72:
export HCP_CLIENT_ID=[YOUR CLIENT] export HCP_CLIENT_SECRET...