packer/website/content/docs/builders/file.mdx
Zachary Shilton cae7bd9e5b
feat(website): add official and HCP Packer Ready labels (#11449)
* refactor(website): use prop and CSS for plugin label spacing

* fix: add official tier label to built-in plugin docs

* feat(website): add BadgesHeader component

* refactor(website): use BadgesHeader in all content

* feat(website): add HCP ready demo, tweak badge look

* refactor: integrate work from add-plugin-version branch

* fix(website): correct bad import

* fix: use updated MDX custom component

* chore: remove plugin version label work from this branch

* chore: remove unused var

* fix: use new BadgesHeader interface for dual tags

* chore: remove unused var, refine comment

* fix: remove unused broken import

* fix: shorten property for HCP packer readiness

* Apply suggestions from code review

Remove a few demo labels before merging

Co-authored-by: Wilken Rivera <dev@wilkenrivera.com>
2021-12-17 10:22:16 -05:00

76 lines
1.7 KiB
Text

---
description: |
The file Packer builder is not really a builder, it just creates an artifact
from a file. It can be used to debug post-processors without incurring high
wait times.
page_title: File - Builders
---
<BadgesHeader>
<PluginBadge type="official" />
</BadgesHeader>
# File Builder
Type: `file`
Artifact BuilderId: `packer.file`
The `file` Packer builder is not really a builder, it just creates an artifact
from a file. It can be used to debug post-processors without incurring high
wait times.
## Basic Example
Below is a fully functioning example. It create a file at `target` with the
specified `content`.
<Tabs>
<Tab heading="JSON">
```json
{
"type": "file",
"content": "Lorem ipsum dolor sit amet",
"target": "dummy_artifact"
}
```
</Tab>
<Tab heading="HCL2">
```hcl
source "file" "basic-example" {
content = "Lorem ipsum dolor sit amet"
target = "dummy_artifact"
}
build {
sources = ["sources.file.basic-example"]
}
```
</Tab>
</Tabs>
## Configuration Reference
Configuration options are organized below into two categories: required and
optional. Within each category, the available options are alphabetized and
described.
Any [communicator](/docs/templates/legacy_json_templates/communicator) defined is ignored.
### Required:
- `target` (string) - The path for the artifact file that will be created. If
the path contains directories that don't exist, Packer will create them, too.
### Optional:
You can only define one of `source` or `content`. If none of them is defined
the artifact will be empty.
- `source` (string) - The path for a file which will be copied as the
artifact.
- `content` (string) - The content that will be put into the artifact.