github.com/bradfeehan/terraform@v0.7.0-rc3.0.20170529055808-34b45c5ad841/website/source/docs/providers/archive/d/archive_file.md (about) 1 --- 2 layout: "archive" 3 page_title: "Archive: archive_file" 4 sidebar_current: "docs-archive-datasource-archive-file" 5 description: |- 6 Generates an archive from content, a file, or directory of files. 7 --- 8 9 # archive_file 10 11 Generates an archive from content, a file, or directory of files. 12 13 ## Example Usage 14 15 ```hcl 16 # Archive a single file. 17 18 data "archive_file" "init" { 19 type = "zip" 20 source_file = "${path.module}/init.tpl" 21 output_path = "${path.module}/files/init.zip" 22 } 23 24 # Archive multiple files. 25 26 data "archive_file" "dotfiles" { 27 type = "zip" 28 output_path = "${path.module}/files/dotfiles.zip" 29 30 source { 31 content = "${data.template_file.vimrc.rendered}" 32 filename = ".vimrc" 33 } 34 35 source { 36 content = "${data.template_file.ssh_config.rendered}" 37 filename = ".ssh/config" 38 } 39 } 40 ``` 41 42 ## Argument Reference 43 44 The following arguments are supported: 45 46 NOTE: One of `source`, `source_content_filename` (with `source_content`), `source_file`, or `source_dir` must be specified. 47 48 * `type` - (Required) The type of archive to generate. 49 NOTE: `zip` is supported. 50 51 * `output_path` - (Required) The output of the archive file. 52 53 * `source_content` - (Optional) Add only this content to the archive with `source_content_filename` as the filename. 54 55 * `source_content_filename` - (Optional) Set this as the filename when using `source_content`. 56 57 * `source_file` - (Optional) Package this file into the archive. 58 59 * `source_dir` - (Optional) Package entire contents of this directory into the archive. 60 61 * `source` - (Optional) Specifies attributes of a single source file to include into the archive. 62 63 The `source` block supports the following: 64 65 * `content` - (Required) Add this content to the archive with `filename` as the filename. 66 67 * `filename` - (Required) Set this as the filename when declaring a `source`. 68 69 ## Attributes Reference 70 71 The following attributes are exported: 72 73 * `output_size` - The size of the output archive file. 74 75 * `output_sha` - The SHA1 checksum of output archive file. 76 77 * `output_base64sha256` - The base64-encoded SHA256 checksum of output archive file. 78 79 * `output_md5` - The MD5 checksum of output archive file.