@ -26,39 +26,39 @@ type Config struct {
AccountFile string ` mapstructure:"account_file" `
ProjectId string ` mapstructure:"project_id" `
AcceleratorType string ` mapstructure:"accelerator_type" `
AcceleratorCount int64 ` mapstructure:"accelerator_count" `
Address string ` mapstructure:"address" `
Dis kName string ` mapstructure:"disk_name "`
Disk SizeGb int64 ` mapstructure:"disk_siz e"`
Disk Type string ` mapstructure:"disk_typ e"`
ImageName string ` mapstructure:"image_nam e"`
Image Description string ` mapstructure:"image_description "`
Image Family string ` mapstructure:"image_family "`
Image Labels map [ string ] string ` mapstructure:"image_labels "`
ImageL icenses [ ] string ` mapstructure:"image_license s"`
I nstanceName string ` mapstructure:"instance_name "`
Labels map [ string ] string ` mapstructure:"labels "`
MachineType string ` mapstructure:"machine_type "`
M etadata map [ string ] string ` mapstructure:"metadata "`
Network string ` mapstructure:"network "`
Network ProjectId string ` mapstructure:"network _project_id "`
OmitExternalIP bool ` mapstructure:"omit_external_ip "`
O nHostMaintenance string ` mapstructure:"on_host_maintenance "`
Preemptible bool ` mapstructure:"preemptibl e"`
RawStateTimeout string ` mapstructure:"state_timeout "`
R egion string ` mapstructure:"region "`
Scopes [ ] string ` mapstructure:"scopes "`
S ourceImage string ` mapstructure:"source_image "`
S ourceImageFamily string ` mapstructure:"source_image_family "`
SourceImage ProjectId string ` mapstructure:"source_image _project_id "`
S tartupScriptFile string ` mapstructure:"startup_script_file "`
S ubnetwork string ` mapstructure:"subnetwork "`
Tags [ ] string ` mapstructure:"tags "`
UseInternalIP bool ` mapstructure:"use_internal_ip "`
Zone string ` mapstructure:"zone "`
ServiceAccountEmail string ` mapstructure:"service_account_email "`
AcceleratorType string ` mapstructure:"accelerator_type" `
AcceleratorCount int64 ` mapstructure:"accelerator_count" `
Address string ` mapstructure:"address" `
Dis ableDefaultServiceAccount bool ` mapstructure:"disable_default_service_account "`
Disk Name string ` mapstructure:"disk_nam e"`
Disk SizeGb int64 ` mapstructure:"disk_siz e"`
DiskType string ` mapstructure:"disk_typ e"`
Image Name string ` mapstructure:"image_name "`
Image Description string ` mapstructure:"image_description "`
Image Family string ` mapstructure:"image_family "`
ImageL abels map [ string ] string ` mapstructure:"image_label s"`
I mageLicenses [ ] string ` mapstructure:"image_licenses "`
InstanceName string ` mapstructure:"instance_name "`
Labels map [ string ] string ` mapstructure:"labels "`
M achineType string ` mapstructure:"machine_type "`
Metadata map [ string ] string ` mapstructure:"metadata "`
Network string ` mapstructure:"network "`
NetworkProjectId string ` mapstructure:"network_project_id "`
O mitExternalIP bool ` mapstructure:"omit_external_ip "`
OnHostMaintenance string ` mapstructure:"on_host_maintenanc e"`
Preemptible bool ` mapstructure:"preemptible "`
R awStateTimeout string ` mapstructure:"state_timeout "`
Region string ` mapstructure:"region "`
S copes [ ] string ` mapstructure:"scopes "`
S erviceAccountEmail string ` mapstructure:"service_account_email "`
SourceImage string ` mapstructure:"source_image "`
S ourceImageFamily string ` mapstructure:"source_image_family "`
S ourceImageProjectId string ` mapstructure:"source_image_project_id "`
StartupScriptFile string ` mapstructure:"startup_script_file "`
Subnetwork string ` mapstructure:"subnetwork "`
Tags [ ] string ` mapstructure:"tags "`
UseInternalIP bool ` mapstructure:"use_internal_ip" `
Zone string ` mapstructure:"zone "`
Account AccountFile
stateTimeout time . Duration
@ -225,6 +225,11 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
errs = packer . MultiErrorAppend ( fmt . Errorf ( "'on_host_maintenance' must be set to 'TERMINATE' when 'accelerator_count' is more than 0" ) )
}
// If DisableDefaultServiceAccount is provided, don't allow a value for ServiceAccountEmail
if c . DisableDefaultServiceAccount && c . ServiceAccountEmail != "" {
errs = packer . MultiErrorAppend ( fmt . Errorf ( "you may not specify a 'service_account_email' when 'disable_default_service_account' is true" ) )
}
// Check for any errors.
if errs != nil && len ( errs . Errors ) > 0 {
return nil , nil , errs