From e1cb0c5f7e6acf8098ab06bd33c55ae718864bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Taneli=20Lepp=C3=A4?= Date: Mon, 2 Dec 2019 11:29:34 +0100 Subject: [PATCH] Added support for specifying Service Account in Google Compute exporter post-processor. (#8388) --- post-processor/googlecompute-export/post-processor.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/post-processor/googlecompute-export/post-processor.go b/post-processor/googlecompute-export/post-processor.go index 6183619a3..133e47dc8 100644 --- a/post-processor/googlecompute-export/post-processor.go +++ b/post-processor/googlecompute-export/post-processor.go @@ -30,6 +30,7 @@ type Config struct { Subnetwork string `mapstructure:"subnetwork"` VaultGCPOauthEngine string `mapstructure:"vault_gcp_oauth_engine"` Zone string `mapstructure:"zone"` + ServiceAccountEmail string `mapstructure:"service_account_email"` account *jwt.Config ctx interpolate.Context @@ -150,6 +151,9 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact "https://www.googleapis.com/auth/userinfo.email", }, } + if p.config.ServiceAccountEmail != "" { + exporterConfig.ServiceAccountEmail = p.config.ServiceAccountEmail + } driver, err := googlecompute.NewDriverGCE(ui, builderProjectId, p.config.account, p.config.VaultGCPOauthEngine)