Inspired by Megan Marsh's talk https://www.hashicorp.com/resources/extending-packer I bit the bullet and started making my own ill advised provisioner for Terraform.
packer {
required_plugins {
terraform = {
version = "= 0.0.7"
source = "github.com/servian/terraform"
}
}
}
source "docker" "test_server" {
commit = true
image = "amazonlinux:2"
}
build {
sources = ["source.docker.test_server"]
provisioner "terraform" {
code_path = "./tfcode"
prevent_sudo = "true"
variable_string = jsonencode({
consul_server_node = false
})
version = "1.0.0"
}
}
version
(string) - the version of Terraform to installcode_path
(string) - (required) the path to the terraform coderun_command
(string) - override the command to run Terraforminstall_command
(string) - override the command to run Terraformstaging_dir
(string) - override the remote path to stage the code.variables
(map(String, String)) - set terraform variables into a terraform.auto.tfvars file
The code is available as open source under the terms of the Mozilla Public License 2.0