From 97848df9e1073f87370ef8cd70899ab8b092c2f0 Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Tue, 16 Jun 2020 17:08:03 +0200 Subject: [PATCH] add basic HCL2 examples for gcp builder --- website/pages/docs/builders/googlecompute.mdx | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/website/pages/docs/builders/googlecompute.mdx b/website/pages/docs/builders/googlecompute.mdx index c37da6510..aecd7a22a 100644 --- a/website/pages/docs/builders/googlecompute.mdx +++ b/website/pages/docs/builders/googlecompute.mdx @@ -119,6 +119,9 @@ repackage an existing GCE image. The account_file is obtained in the previous section. If it parses as JSON it is assumed to be the file itself, otherwise, it is assumed to be the path to the file containing the JSON. + + + ```json { "builders": [ @@ -134,6 +137,26 @@ it is assumed to be the path to the file containing the JSON. } ``` + + + +```hcl +source "googlecompute" "basic-example" { + account_file = "account.json" + project_id = "my project" + source_image = "debian-7-wheezy-v20150127" + ssh_username = "packer" + zone = "us-central1-a" +} + +build { + sources = ["sources.googlecompute.basic-example"] +} +``` + + + + ### Windows Example Before you can provision using the winrm communicator, you need to allow