github.com/hashicorp/packer@v1.14.3/website/content/docs/builders/file.mdx (about) 1 --- 2 description: | 3 The `file` builder creates an artifact from a file. Use the `file` builder to debug post-processors without incurring long wait times. 4 page_title: file builder reference 5 --- 6 7 <BadgesHeader> 8 <PluginBadge type="official" /> 9 </BadgesHeader> 10 11 # `file` builder 12 13 The `file` builder creates an artifact from a file. You can use it to debug post-processors without incurring long wait times. 14 15 Artifact `BuilderId`: `packer.file` 16 17 ## Basic Example 18 19 Below is a fully functioning example. It create a file at `target` with the 20 specified `content`. 21 22 <Tabs> 23 <Tab heading="HCL2"> 24 25 ```hcl 26 source "file" "basic-example" { 27 content = "Lorem ipsum dolor sit amet" 28 target = "dummy_artifact" 29 } 30 31 build { 32 sources = ["sources.file.basic-example"] 33 } 34 ``` 35 36 </Tab> 37 <Tab heading="JSON"> 38 39 ```json 40 { 41 "type": "file", 42 "content": "Lorem ipsum dolor sit amet", 43 "target": "dummy_artifact" 44 } 45 ``` 46 47 </Tab> 48 </Tabs> 49 50 ## Configuration Reference 51 52 Configuration options are organized below into two categories: required and 53 optional. Within each category, the available options are alphabetized and 54 described. 55 56 Any [communicator](/packer/docs/templates/legacy_json_templates/communicator) defined is ignored. 57 58 ### Required 59 60 - `target` (string) - The path for the artifact file that will be created. If 61 the path contains directories that don't exist, Packer will create them, too. 62 63 ### Optional 64 65 You can only define one of `source` or `content`. If none of them is defined 66 the artifact will be empty. 67 68 - `source` (string) - The path for a file which will be copied as the 69 artifact. 70 71 - `content` (string) - The content that will be put into the artifact.