Adrien Delorme 741a6e4182
HCL2 only: Make provisioners and post-processors reprepare themselves with build data (#9534)
#9444 allows to share builder infos with provisioners and post-processor by re-starting new provisioners and post-processors once the build has started; #9490 allows to 'excpect/only' on a full build blocks (after naming a block), merged together, the tests of #9490 fail. This means we would have to reimplement the only/except logic. While this could have worked, re-using the already started provisioners and post-processor for HCL2 is better/simpler IMO as we won't have to maintain a feature parity.

Also with HCL2 and go-cty all struct ( here provisioner/post-processor) fields are set at the moment of configuring so we should not get weird 'default value' behaviour issue.

This PR reverts some parts of #9444 and implement #9444 in a different manner: I created specific HCL2Provisioner and HCL2PostProcessor structs that both re-prepare themselves right before provisioning. I think this makes the code a little simpler and lays a nice ground for improvement.
2020-07-07 12:10:02 +02:00
2020-06-29 15:43:35 -04:00
2020-05-29 09:40:31 -07:00
2020-07-07 12:00:36 +02:00
2019-09-26 12:13:02 +01:00
2020-06-18 11:31:00 -07:00
2020-07-07 11:52:08 +02:00
2020-05-29 09:43:31 -07:00
2020-06-09 21:15:36 +00:00
2020-05-14 16:02:51 +02:00
2019-09-18 10:54:35 -07:00
2020-07-02 14:40:11 -07:00
2017-04-04 13:39:01 -07:00
2020-06-24 14:31:05 +02:00
2020-06-24 14:31:05 +02:00
2013-06-24 14:29:15 -07:00
2017-04-04 13:39:01 -07:00

Packer

Build Status Windows Build Status GoDoc GoReportCard codecov

Packer is a tool for building identical machine images for multiple platforms from a single source configuration.

Packer is lightweight, runs on every major operating system, and is highly performant, creating machine images for multiple platforms in parallel. Packer comes out of the box with support for many platforms, the full list of which can be found at https://www.packer.io/docs/builders/index.html.

Support for other platforms can be added via plugins.

The images that Packer creates can easily be turned into Vagrant boxes.

Quick Start

Note: There is a great introduction and getting started guide for those with a bit more patience. Otherwise, the quick start below will get you up and running quickly, at the sacrifice of not explaining some key points.

First, download a pre-built Packer binary for your operating system or compile Packer yourself.

After Packer is installed, create your first template, which tells Packer what platforms to build images for and how you want to build them. In our case, we'll create a simple AMI that has Redis pre-installed. Save this file as quick-start.json. Export your AWS credentials as the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.

{
  "variables": {
    "access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
    "secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}"
  },
  "builders": [{
    "type": "amazon-ebs",
    "access_key": "{{user `access_key`}}",
    "secret_key": "{{user `secret_key`}}",
    "region": "us-east-1",
    "source_ami": "ami-af22d9b9",
    "instance_type": "t2.micro",
    "ssh_username": "ubuntu",
    "ami_name": "packer-example {{timestamp}}"
  }]
}

Next, tell Packer to build the image:

$ packer build quick-start.json
...

Packer will build an AMI according to the "quick-start" template. The AMI will be available in your AWS account. To delete the AMI, you must manually delete it using the AWS console. Packer builds your images, it does not manage their lifecycle. Where they go, how they're run, etc., is up to you.

Documentation

Comprehensive documentation is viewable on the Packer website:

https://www.packer.io/docs

Developing Packer

See CONTRIBUTING.md for best practices and instructions on setting up your development environment to work on Packer.

Description
No description provided
Readme 102 MiB
Languages
Go 67%
MDX 22%
JavaScript 4.6%
HCL 2.7%
Shell 1.7%
Other 1.9%