Added support for specifying Service Account in Google Compute exporter post-processor. (#8388)

This commit is contained in:
Taneli Leppä 2019-12-02 11:29:34 +01:00 committed by Adrien Delorme
parent cf6058b8fb
commit e1cb0c5f7e

View File

@ -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)