Base image strategy
Maybe separation of duty means that different people have control over different cloud resources or container registries. Maybe some HCL files in a template directory should be read-only while others, such as variable declarations, may be edited. We need to build out a directory structure that accommodates collaboration and also helps us reuse common code. Remember that HCL doesn’t have an include
or a require
directive to import other files or modules. You can run Packer against a single HCL file or against a directory, which will result in the combination of all HCL files included. It’s not so easy to #include common.hcl
from a shared read-only space. Luckily, we have the simple option of symbolic links for this, where you can alias a common template file into your template directory. Here is an example:
$ ln –s ../common/basicconfig.hcl .
If you look at the GitHub repository for this project, you’ll see that the single HCL2 file...