gce_instance_template: fix allow the setting of the service account (#29154)
This commit is contained in:
parent
01b6c7c9c6
commit
d6520c64b3
1 changed files with 5 additions and 1 deletions
|
@ -290,6 +290,7 @@ def create_instance_template(module, gce):
|
|||
external_ip = module.params.get('external_ip')
|
||||
service_account_permissions = module.params.get(
|
||||
'service_account_permissions')
|
||||
service_account_email = module.params.get('service_account_email')
|
||||
on_host_maintenance = module.params.get('on_host_maintenance')
|
||||
automatic_restart = module.params.get('automatic_restart')
|
||||
preemptible = module.params.get('preemptible')
|
||||
|
@ -369,7 +370,10 @@ def create_instance_template(module, gce):
|
|||
bad_perms.append(perm)
|
||||
if len(bad_perms) > 0:
|
||||
module.fail_json(msg='bad permissions: %s' % str(bad_perms))
|
||||
ex_sa_perms.append({'email': "default"})
|
||||
if service_account_email is not None:
|
||||
ex_sa_perms.append({'email': str(service_account_email)})
|
||||
else:
|
||||
ex_sa_perms.append({'email': "default"})
|
||||
ex_sa_perms[0]['scopes'] = service_account_permissions
|
||||
gce_args['service_accounts'] = ex_sa_perms
|
||||
|
||||
|
|
Loading…
Reference in a new issue