mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-08-07 06:34:29 -07:00
Merge 6d61b6699b
into 99ac225a1a
This commit is contained in:
commit
67546ca687
5 changed files with 152 additions and 2 deletions
|
@ -255,7 +255,11 @@ def main():
|
|||
|
||||
def create(module):
|
||||
auth = GcpSession(module, 'iam')
|
||||
json_content = return_if_object(module, auth.post(self_link(module), resource_to_request(module)))
|
||||
response = auth.post(self_link(module), resource_to_request(module))
|
||||
if response.status_code == 404:
|
||||
name = replace_resource_dict(module.params['service_account'], 'name')
|
||||
module.fail_json(msg="No such Service Account: %s" % name)
|
||||
json_content = return_if_object(module, response)
|
||||
with open(module.params['path'], 'w') as f:
|
||||
private_key_contents = to_native(base64.b64decode(json_content['privateKeyData']))
|
||||
f.write(private_key_contents)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue