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.
Using build variables - Packer Tutorial
From the course: Learning HashiCorp Packer
Using build variables
- [Instructor] The build command takes in extra flags, one of which is the var flag, or variable flag. The var flag allows for variables to be passed in when running a build. An example of variables would be an AWS key and secret, something you don't want to hard code into a template, but use it when building. So far, we've been using the AWS key and secret configured for use with the AWS CLI. This is not going to be present on every machine you run Packer. If you run Packer on a CI server it's unlikely that the AWS CLI will be installed, and so far we've been using the AWS key and secret, configured for use with the AWS CLI. This is not going to be present on every machine. If you run your packer build on a CI server, it's unlikely the AWS CLI will be installed and configured. Instead we can input these secrets as variables when building the template. So let's set the AWS access key variable into this template. Variables are at the same level as builders, so if we put it at the top…
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.
Contents
-
-
-
-
(Locked)
Select an AWS AMI base2m 31s
-
(Locked)
Automate AWS AMI base build3m 28s
-
(Locked)
Using build variables6m 55s
-
(Locked)
Provision Hello World1m 59s
-
(Locked)
Provision a basic site3m 40s
-
(Locked)
Challenge: Provision a MariaDB server40s
-
(Locked)
Solution: Provision a MariaDB server3m 45s
-
(Locked)
-
-
-
-