github.com/rahart/packer@v0.12.2-0.20161229105310-282bb6ad370f/website/source/docs/post-processors/googlecompute-export.html.md (about) 1 --- 2 description: | 3 The Google Compute Image Exporter post-processor exports an image from a Packer 4 googlecompute builder run and uploads it to Google Cloud Storage. The exported 5 images can be easily shared and uploaded to other Google Cloud Projects. 6 layout: docs 7 page_title: 'Google Compute Image Exporter' 8 ... 9 10 # Google Compute Image Exporter Post-Processor 11 12 Type: `googlecompute-export` 13 14 The Google Compute Image Exporter post-processor exports the resultant image from a 15 googlecompute build as a gzipped tarball to Google Cloud Storage (GCS). 16 17 The exporter uses the same Google Cloud Platform (GCP) project and authentication 18 credentials as the googlecompute build that produced the image. A temporary VM is 19 started in the GCP project using these credentials. The VM mounts the built image as 20 a disk then dumps, compresses, and tars the image. The VM then uploads the tarball 21 to the provided GCS `paths` using the same credentials. 22 23 As such, the authentication credentials that built the image must have write 24 permissions to the GCS `paths`. 25 26 27 ## Configuration 28 29 ### Required 30 31 - `paths` (list of string) - The list of GCS paths, e.g. 32 'gs://mybucket/path/to/file.tar.gz', where the image will be exported. 33 34 ### Optional 35 36 - `keep_input_artifact` (bool) - If true, do not delete the Google Compute Engine 37 (GCE) image being exported. 38 39 ## Basic Example 40 41 The following example builds a GCE image in the project, `my-project`, with an 42 account whose keyfile is `account.json`. After the image build, a temporary VM will 43 be created to export the image as a gzipped tarball to 44 `gs://mybucket1/path/to/file1.tar.gz` and `gs://mybucket2/path/to/file2.tar.gz`. 45 `keep_input_artifact` is true, so the GCE image won't be deleted after the export. 46 47 In order for this example to work, the account associated with `account.json` must 48 have write access to both `gs://mybucket1/path/to/file1.tar.gz` and 49 `gs://mybucket2/path/to/file2.tar.gz`. 50 51 ``` {.json} 52 { 53 "builders": [ 54 { 55 "type": "googlecompute", 56 "account_file": "account.json", 57 "project_id": "my-project", 58 "source_image": "debian-7-wheezy-v20150127", 59 "zone": "us-central1-a" 60 } 61 ], 62 "post-processors": [ 63 { 64 "type": "googlecompute-export", 65 "paths": [ 66 "gs://mybucket1/path/to/file1.tar.gz", 67 "gs://mybucket2/path/to/file2.tar.gz" 68 ] 69 "keep_input_artifact": true 70 } 71 ] 72 } 73 ```