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