pp.google.[import|export]: unexport Account field

so it doesnt temper with hcl2 cfg generation
This commit is contained in:
Adrien Delorme 2019-10-14 16:19:17 +02:00
parent af08e2a410
commit 771a6e55ef
2 changed files with 7 additions and 7 deletions

View File

@ -28,7 +28,7 @@ type Config struct {
VaultGCPOauthEngine string `mapstructure:"vault_gcp_oauth_engine"` VaultGCPOauthEngine string `mapstructure:"vault_gcp_oauth_engine"`
Zone string `mapstructure:"zone"` Zone string `mapstructure:"zone"`
Account *jwt.Config account *jwt.Config
ctx interpolate.Context ctx interpolate.Context
} }
@ -108,14 +108,14 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact
if err != nil { if err != nil {
return nil, false, false, err return nil, false, false, err
} }
p.config.Account = cfg p.config.account = cfg
} }
if p.config.AccountFile != "" { if p.config.AccountFile != "" {
cfg, err := googlecompute.ProcessAccountFile(p.config.AccountFile) cfg, err := googlecompute.ProcessAccountFile(p.config.AccountFile)
if err != nil { if err != nil {
return nil, false, false, err return nil, false, false, err
} }
p.config.Account = cfg p.config.account = cfg
} }
// Set up exporter instance configuration. // Set up exporter instance configuration.
@ -150,7 +150,7 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact
exporterConfig.CalcTimeout() exporterConfig.CalcTimeout()
driver, err := googlecompute.NewDriverGCE(ui, builderProjectId, driver, err := googlecompute.NewDriverGCE(ui, builderProjectId,
p.config.Account, p.config.VaultGCPOauthEngine) p.config.account, p.config.VaultGCPOauthEngine)
if err != nil { if err != nil {
return nil, false, false, err return nil, false, false, err
} }

View File

@ -36,7 +36,7 @@ type Config struct {
SkipClean bool `mapstructure:"skip_clean"` SkipClean bool `mapstructure:"skip_clean"`
VaultGCPOauthEngine string `mapstructure:"vault_gcp_oauth_engine"` VaultGCPOauthEngine string `mapstructure:"vault_gcp_oauth_engine"`
Account *jwt.Config account *jwt.Config
ctx interpolate.Context ctx interpolate.Context
} }
@ -76,7 +76,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
if err != nil { if err != nil {
errs = packer.MultiErrorAppend(errs, err) errs = packer.MultiErrorAppend(errs, err)
} }
p.config.Account = cfg p.config.account = cfg
} }
if p.config.AccountFile != "" && p.config.VaultGCPOauthEngine != "" { if p.config.AccountFile != "" && p.config.VaultGCPOauthEngine != "" {
@ -105,7 +105,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
} }
func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) { func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, bool, error) {
client, err := googlecompute.NewClientGCE(p.config.Account, p.config.VaultGCPOauthEngine) client, err := googlecompute.NewClientGCE(p.config.account, p.config.VaultGCPOauthEngine)
if err != nil { if err != nil {
return nil, false, false, err return nil, false, false, err
} }