packer-post-processor-tfvars

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2016 License: MIT Imports: 9 Imported by: 0

README

Packer Post-Processor to Export Terraform Variables

Building Amazon Machine Images (AMIs) using Packer with the Amazon builders is immensely useful, but it can be hard to feed the produced AMI IDs into Terraform, or other automation tools. This post-processor exports the producted artifact information into a JSON file which can be fed into a Terraform plan as a var file, or into other tools. The original artifact is also passed through for further post-processing.

Usage

Compile and install the binary terraform-post-processor-tfvars, and add the post-processor to your packer template, something like:

{
  "builders": [
    {
      "name": "my-image",
      "type": "amazon-ebs",
      "region": "us-east-1",
      ...
    }
  ],
  "post-processors": [
    {
      "type": "tfvars",
      "output": "packer.tfvars"
    }
  ]
}

Run your packer build. It should create a packer.tfvars file with JSON describing the built AMIs. Then you can use this in your terraform config:

aws_instance "my-instance" {
  ami = "${var.packer-us-east-1-my-image}"
}

TODO

  • Remote support, S3, like remote state
  • Existing files: replace/update/ignore
  • Customisable variables names and values
  • HCL support?

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL