Debian Codegraph @

ansible_collections/google/cloud/tests/integration/targets/gcp_resourcemanager_project/tasks/autogen.yml

raw symbols SCIP
1 ---
2 # ----------------------------------------------------------------------------
3 #
4 # *** AUTO GENERATED CODE *** Type: MMv1 ***
5 #
6 # ----------------------------------------------------------------------------
7 #
8 # This file is automatically generated by Magic Modules and manual
9 # changes will be clobbered when the file is regenerated.
10 #
11 # Please read more about how to change this file at
12 # https://www.github.com/GoogleCloudPlatform/magic-modules
13 #
14 # ----------------------------------------------------------------------------
15 # Pre-test setup
16 - name: Delete a project
17 google.cloud.gcp_resourcemanager_project:
18 name: "{{ resource_prefix[0:30] }}"
19 id: "{{ resource_prefix[0:30] }}"
20 auth_kind: "{{ gcp_cred_kind }}"
21 service_account_file: "{{ gcp_cred_file | default(omit) }}"
22 parent:
23 type: folder
24 id: "{{ gcp_folder_id }}"
25 state: absent
26 # ----------------------------------------------------------
27 - name: Create a project
28 google.cloud.gcp_resourcemanager_project:
29 name: "{{ resource_prefix[0:30] }}"
30 id: "{{ resource_prefix[0:30] }}"
31 auth_kind: "{{ gcp_cred_kind }}"
32 service_account_file: "{{ gcp_cred_file | default(omit) }}"
33 parent:
34 type: folder
35 id: "{{ gcp_folder_id }}"
36 state: present
37 register: result
38 - name: Assert changed is true
39 ansible.builtin.assert:
40 that:
41 - result.changed == true
42 - name: Pause for 2 minutes for project to appear
43 ansible.builtin.pause:
44 minutes: 2
45 - name: Verify that project was created
46 google.cloud.gcp_resourcemanager_project_info:
47 project: "{{ gcp_project }}"
48 auth_kind: "{{ gcp_cred_kind }}"
49 service_account_file: "{{ gcp_cred_file | default(omit) }}"
50 # choose 1000 projects so iterate past the deleted ones.
51 page_size: 1000
52 scopes:
53 - https://www.googleapis.com/auth/cloud-platform
54 register: results
55 - name: Verify that command succeeded
56 ansible.builtin.assert:
57 that:
58 - results['resources'] | selectattr("lifecycleState", "equalto", "ACTIVE") | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30] }}.*") | list
59 | length == 1
60 # ----------------------------------------------------------------------------
61 - name: Create a project that already exists
62 google.cloud.gcp_resourcemanager_project:
63 name: "{{ resource_prefix[0:30] }}"
64 id: "{{ resource_prefix[0:30] }}"
65 auth_kind: "{{ gcp_cred_kind }}"
66 service_account_file: "{{ gcp_cred_file | default(omit) }}"
67 parent:
68 type: folder
69 id: "{{ gcp_folder_id }}"
70 state: present
71 register: result
72 - name: Assert changed is false
73 ansible.builtin.assert:
74 that:
75 - result.changed == false
76 # ----------------------------------------------------------
77 - name: Delete a project
78 google.cloud.gcp_resourcemanager_project:
79 name: "{{ resource_prefix[0:30] }}"
80 id: "{{ resource_prefix[0:30] }}"
81 auth_kind: "{{ gcp_cred_kind }}"
82 service_account_file: "{{ gcp_cred_file | default(omit) }}"
83 parent:
84 type: folder
85 id: "{{ gcp_folder_id }}"
86 state: absent
87 register: result
88 - name: Assert changed is true
89 ansible.builtin.assert:
90 that:
91 - result.changed == true
92 - name: Pause for 2 minutes for project to appear
93 ansible.builtin.pause:
94 minutes: 2
95 - name: Verify that project was deleted
96 google.cloud.gcp_resourcemanager_project_info:
97 project: "{{ resource_prefix[0:30] }}"
98 auth_kind: "{{ gcp_cred_kind }}"
99 service_account_file: "{{ gcp_cred_file | default(omit) }}"
100 # choose 1000 projects so iterate past the deleted ones.
101 page_size: 1000
102 scopes:
103 - https://www.googleapis.com/auth/cloud-platform
104 register: results
105 - name: Verify that command succeeded
106 ansible.builtin.assert:
107 that:
108 - results['resources'] | selectattr("lifecycleState", "equalto", "DELETE_REQUESTED") | map(attribute='name') | select("match", ".*{{ resource_prefix[0:30] }}.*")
109 | list | length == 1
110 # ----------------------------------------------------------------------------
111 - name: Delete a project that does not exist
112 google.cloud.gcp_resourcemanager_project:
113 name: "{{ resource_prefix[0:30] }}"
114 id: "{{ resource_prefix[0:30] }}"
115 auth_kind: "{{ gcp_cred_kind }}"
116 service_account_file: "{{ gcp_cred_file | default(omit) }}"
117 parent:
118 type: folder
119 id: "{{ gcp_folder_id }}"
120 state: absent
121 register: result
122 - name: Assert changed is false
123 ansible.builtin.assert:
124 that:
125 - result.changed == false