Creating Service Accounts (#125)

<!-- This change is generated by MagicModules. -->
/cc @rambleraptor
This commit is contained in:
The Magician 2018-11-05 11:35:37 -08:00 committed by Alex Stephen
commit ff78ac3b85
4 changed files with 72 additions and 56 deletions

View file

@ -1,3 +1,3 @@
---
resource_name: "{{ resource_prefix }}"
sa_name: sa-{{ 100000 | random }}@graphite-playground.google.com.iam.gserviceaccount.com
# defaults file
resource_name: '{{resource_prefix}}'

View file

@ -15,21 +15,21 @@
# Pre-test setup
- name: delete a service account
gcp_iam_service_account:
name: "{{ sa_name }}"
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
#----------------------------------------------------------
- name: create a service account
gcp_iam_service_account:
name: "{{ sa_name }}"
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is true
assert:
@ -50,12 +50,12 @@
# ----------------------------------------------------------------------------
- name: create a service account that already exists
gcp_iam_service_account:
name: "{{ sa_name }}"
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: present
register: result
- name: assert changed is false
assert:
@ -64,12 +64,12 @@
#----------------------------------------------------------
- name: delete a service account
gcp_iam_service_account:
name: "{{ sa_name }}"
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is true
assert:
@ -90,12 +90,12 @@
# ----------------------------------------------------------------------------
- name: delete a service account that does not exist
gcp_iam_service_account:
name: "{{ sa_name }}"
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
name: test-ansible@graphite-playground.google.com.iam.gserviceaccount.com
display_name: My Ansible test key
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_cred_kind }}"
service_account_file: "{{ gcp_cred_file }}"
state: absent
register: result
- name: assert changed is false
assert: