Skip to content

Commit c14032c

Browse files
packer migration (#1306)
1 parent 8897a8b commit c14032c

File tree

3,765 files changed

+257204
-25
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,765 files changed

+257204
-25
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
page_title: Community vs HashiCorp Maintained Plugins
3+
description: Packer maintains these core plugins.
4+
---
5+
6+
# HashiCorp Maintained Plugins
7+
8+
The following plugins (i.e. Builders, Provisioners, and Post-Processors) are
9+
maintained by HashiCorp. Any plugins not on this list are maintained by the
10+
community, and not actively contributed to by HashiCorp, although they are
11+
still distributed with Packer. If you are interested in seeing features or
12+
bugfixes to these plugins, please consider making a pull request, or asking the
13+
HashiCorp maintainers for advice on how to get started contributing.
14+
15+
## Builders
16+
17+
- Amazon EC2
18+
- Azure
19+
- Docker
20+
- Google Cloud
21+
- VMware
22+
- VirtualBox
23+
24+
## Provisioners
25+
26+
- File
27+
- InSpec
28+
- PowerShell
29+
- Shell
30+
- Windows Restart
31+
- Windows Shell
32+
33+
## Post-Processors
34+
35+
- Amazon Import
36+
- Artifice
37+
- Docker
38+
- Local Shell
39+
- Manifest
40+
- Vagrant
41+
- Vagrant Cloud
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
description: |
3+
Community-maintained builders are not part of the core Packer binary, but
4+
can run alongside Packer with minimal extra effort.
5+
page_title: Community - Builders
6+
---
7+
8+
# Community Builders
9+
10+
The following builders are developed and maintained by various members of the
11+
Packer community, not by HashiCorp. For more information on how to use community
12+
builders, see our docs on [extending Packer](/packer/docs/plugins/creation).
13+
14+
@include 'builders/community_builders.mdx'
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
description: |
3+
Packer is extensible, allowing you to write new builders without having to
4+
modify the core source code of Packer itself. Documentation for creating new
5+
builders is covered in the custom builders page of the Packer plugin section.
6+
page_title: Custom - Builders
7+
---
8+
9+
# Custom Builder
10+
11+
Packer is extensible, allowing you to write new builders without having to
12+
modify the core source code of Packer itself. Documentation for creating new
13+
builders is covered in the [custom
14+
builders](/packer/docs/plugins/creation/custom-builders) page of the Packer plugin
15+
section.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
description: |
3+
The file Packer builder is not really a builder, it just creates an artifact
4+
from a file. It can be used to debug post-processors without incurring high
5+
wait times.
6+
page_title: File - Builders
7+
---
8+
9+
<BadgesHeader>
10+
<PluginBadge type="official" />
11+
</BadgesHeader>
12+
13+
# File Builder
14+
15+
Type: `file`
16+
Artifact BuilderId: `packer.file`
17+
18+
The `file` Packer builder is not really a builder, it just creates an artifact
19+
from a file. It can be used to debug post-processors without incurring high
20+
wait times.
21+
22+
## Basic Example
23+
24+
Below is a fully functioning example. It create a file at `target` with the
25+
specified `content`.
26+
27+
<Tabs>
28+
<Tab heading="JSON">
29+
30+
```json
31+
{
32+
"type": "file",
33+
"content": "Lorem ipsum dolor sit amet",
34+
"target": "dummy_artifact"
35+
}
36+
```
37+
38+
</Tab>
39+
<Tab heading="HCL2">
40+
41+
```hcl
42+
source "file" "basic-example" {
43+
content = "Lorem ipsum dolor sit amet"
44+
target = "dummy_artifact"
45+
}
46+
47+
build {
48+
sources = ["sources.file.basic-example"]
49+
}
50+
```
51+
52+
</Tab>
53+
</Tabs>
54+
55+
## Configuration Reference
56+
57+
Configuration options are organized below into two categories: required and
58+
optional. Within each category, the available options are alphabetized and
59+
described.
60+
61+
Any [communicator](/packer/docs/templates/legacy_json_templates/communicator) defined is ignored.
62+
63+
### Required:
64+
65+
- `target` (string) - The path for the artifact file that will be created. If
66+
the path contains directories that don't exist, Packer will create them, too.
67+
68+
### Optional:
69+
70+
You can only define one of `source` or `content`. If none of them is defined
71+
the artifact will be empty.
72+
73+
- `source` (string) - The path for a file which will be copied as the
74+
artifact.
75+
76+
- `content` (string) - The content that will be put into the artifact.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
description: |
3+
Builders are responsible for creating machines and generating images from them
4+
for various platforms.
5+
page_title: Builders
6+
---
7+
8+
# Builders
9+
10+
Builders create machines and generate images from those machines for various platforms. Packer also has some builders that perform helper tasks, like running provisioners.
11+
12+
Packer has the following types of builders:
13+
14+
- [Plugin](/packer/plugins): Each plugin has its own associated set of builders. For example, there are separate builders for EC2, VMware, VirtualBox, etc.
15+
- [File](/packer/docs/builders/file): The `file` builder creates an artifact from a file.
16+
- [Null](/packer/docs/builders/null): The `null` builder sets up an SSH connection and runs the provisioners.
17+
- [Custom](/packer/docs/plugins/creation/custom-builders): You can write new builders for new or existing platforms.
18+
- [Community-Supported](/packer/docs/builders/community-supported): The Packer community develops and maintains builders for several additional platforms.
19+
20+
Refer to the [`source`](/packer/docs/templates/hcl_templates/blocks/source) block documentation to learn more about configuring builders in the Packer templating language.
21+
22+
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
description: |
3+
The null Packer builder is not really a builder, it just sets up an SSH
4+
connection and runs the provisioners. It can be used to debug provisioners
5+
without incurring high wait times. It does not create any kind of image or
6+
artifact.
7+
page_title: Null - Builders
8+
---
9+
10+
<BadgesHeader>
11+
<PluginBadge type="official" />
12+
</BadgesHeader>
13+
14+
# Null Builder
15+
16+
Type: `null`
17+
18+
The `null` Packer builder is not really a builder, it just sets up an SSH
19+
connection and runs the provisioners. It can be used to debug provisioners
20+
without incurring high wait times. It does not create any kind of image or
21+
artifact.
22+
23+
## Basic Example
24+
25+
Below is a fully functioning example. It doesn't do anything useful, since no
26+
provisioners are defined, but it will connect to the specified host via ssh.
27+
28+
<Tabs>
29+
<Tab heading="JSON">
30+
31+
```json
32+
{
33+
"type": "null",
34+
"ssh_host": "127.0.0.1",
35+
"ssh_username": "foo",
36+
"ssh_password": "bar"
37+
}
38+
```
39+
40+
</Tab>
41+
<Tab heading="HCL2">
42+
43+
```hcl
44+
source "null" "basic-example" {
45+
ssh_host = "127.0.0.1"
46+
ssh_username = "foo"
47+
ssh_password = "bar"
48+
}
49+
50+
build {
51+
sources = ["sources.null.basic-example"]
52+
}
53+
```
54+
55+
</Tab>
56+
</Tabs>
57+
58+
## Configuration Reference
59+
60+
The null builder has no configuration parameters other than the
61+
[communicator](/packer/docs/templates/legacy_json_templates/communicator) settings.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
description: |
3+
The `packer build` command takes a template and runs all the builds within it
4+
in order to generate a set of artifacts. The various builds specified within a
5+
template are executed in parallel, unless otherwise specified. And the
6+
artifacts that are created will be outputted at the end of the build.
7+
page_title: packer build - Commands
8+
---
9+
10+
# `build` Command
11+
12+
The `packer build` command takes a template and runs all the builds within it
13+
in order to generate a set of artifacts. The various builds specified within a
14+
template are executed in parallel, unless otherwise specified. And the
15+
artifacts that are created will be outputted at the end of the build.
16+
17+
## Options
18+
19+
- `-color=false` - Disables colorized output. Enabled by default.
20+
21+
- `-debug` - Disables parallelization and enables debug mode. Debug mode
22+
flags the builders that they should output debugging information. The exact
23+
behavior of debug mode is left to the builder. In general, builders usually
24+
will stop between each step, waiting for keyboard input before continuing.
25+
This will allow the user to inspect state and so on.
26+
27+
`@include 'commands/except.mdx'`
28+
29+
- `-force` - Forces a builder to run when artifacts from a previous build
30+
prevent a build from running. The exact behavior of a forced build is left
31+
to the builder. In general, a builder supporting the forced build will
32+
remove the artifacts from the previous build. This will allow the user to
33+
repeat a build without having to manually clean these artifacts beforehand.
34+
35+
- `-on-error=cleanup` (default), `-on-error=abort`, `-on-error=ask`, `-on-error=run-cleanup-provisioner` -
36+
Selects what to do when the build fails during provisioning. Please note that
37+
this only affects the build during the provisioner run, not during the
38+
post-processor run, because it is related to whether or not to keep the
39+
instance running and related artifacts like generated SSH keys on the system
40+
when a provisioner fails.
41+
42+
- `cleanup` cleans up after the previous steps, deleting temporary files and virtual machines.
43+
- `abort` exits without any cleanup, which might require the next build to use `-force`.
44+
- `ask` presents a prompt and waits for you to decide to clean up, abort, or retry
45+
the failed step.
46+
- `run-cleanup-provisioner` aborts and exits without any cleanup besides
47+
the [error-cleanup-provisioner](/packer/docs/templates/legacy_json_templates/provisioners#on-error-provisioner) if one is defined.
48+
49+
`@include 'commands/only.mdx'`
50+
51+
- `-parallel-builds=N` - Limit the number of builds to run in parallel, 0
52+
means no limit (defaults to 0).
53+
54+
- `-timestamp-ui` - Enable prefixing of each ui output with an RFC3339
55+
timestamp.
56+
57+
- `-var` - Set a variable in your Packer template. This option can be used
58+
multiple times. This is useful for setting version numbers for your build.
59+
60+
- `-var-file` - Set template variables from a file.
61+
62+
- `-warn-on-undeclared-var` - Setting this flag will yield a warning for each assignment within
63+
a variable definitions file (*.pkrvars.hcl | *.pkrvars.json) that does not have an accompanying
64+
variable block. This can occur when using a var-file that contains a large amount of unused variables
65+
for a given HCL2 template. For HCL2 template builds defining a value for a variable in a var-file is
66+
not enough on its own for Packer to function, as there also needs to be a variable block definition in
67+
the template files `pkr.hcl` for the variable. By default `packer build` will not warn when a var-file
68+
contains one or more undeclared variables.

0 commit comments

Comments
 (0)