Debian Codegraph @

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

raw
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 instance
17 google.cloud.gcp_sql_instance:
18 name: "{{ resource_name }}-2"
19 settings:
20 ip_configuration:
21 authorized_networks:
22 - name: google dns server
23 value: 8.8.8.8/32
24 tier: db-n1-standard-1
25 region: us-central1
26 project: "{{ gcp_project }}"
27 auth_kind: "{{ gcp_cred_kind }}"
28 service_account_file: "{{ gcp_cred_file | default(omit) }}"
29 state: absent
30 # ----------------------------------------------------------
31 - name: Create a instance
32 google.cloud.gcp_sql_instance:
33 name: "{{ resource_name }}-2"
34 settings:
35 ip_configuration:
36 authorized_networks:
37 - name: google dns server
38 value: 8.8.8.8/32
39 tier: db-n1-standard-1
40 region: us-central1
41 project: "{{ gcp_project }}"
42 auth_kind: "{{ gcp_cred_kind }}"
43 service_account_file: "{{ gcp_cred_file | default(omit) }}"
44 state: present
45 register: result
46 - name: Assert changed is true
47 ansible.builtin.assert:
48 that:
49 - result.changed == true
50 - name: Verify that instance was created
51 google.cloud.gcp_sql_instance_info:
52 project: "{{ gcp_project }}"
53 auth_kind: "{{ gcp_cred_kind }}"
54 service_account_file: "{{ gcp_cred_file | default(omit) }}"
55 scopes:
56 - https://www.googleapis.com/auth/sqlservice.admin
57 register: results
58 - name: Verify that command succeeded
59 ansible.builtin.assert:
60 that:
61 - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}-2.*") | list | length == 1
62 # ----------------------------------------------------------------------------
63 - name: Create a instance that already exists
64 google.cloud.gcp_sql_instance:
65 name: "{{ resource_name }}-2"
66 settings:
67 ip_configuration:
68 authorized_networks:
69 - name: google dns server
70 value: 8.8.8.8/32
71 tier: db-n1-standard-1
72 region: us-central1
73 project: "{{ gcp_project }}"
74 auth_kind: "{{ gcp_cred_kind }}"
75 service_account_file: "{{ gcp_cred_file | default(omit) }}"
76 state: present
77 register: result
78 - name: Assert changed is false
79 ansible.builtin.assert:
80 that:
81 - result.changed == false
82 # ----------------------------------------------------------
83 - name: Delete a instance
84 google.cloud.gcp_sql_instance:
85 name: "{{ resource_name }}-2"
86 settings:
87 ip_configuration:
88 authorized_networks:
89 - name: google dns server
90 value: 8.8.8.8/32
91 tier: db-n1-standard-1
92 region: us-central1
93 project: "{{ gcp_project }}"
94 auth_kind: "{{ gcp_cred_kind }}"
95 service_account_file: "{{ gcp_cred_file | default(omit) }}"
96 state: absent
97 register: result
98 - name: Assert changed is true
99 ansible.builtin.assert:
100 that:
101 - result.changed == true
102 - name: Verify that instance was deleted
103 google.cloud.gcp_sql_instance_info:
104 project: "{{ gcp_project }}"
105 auth_kind: "{{ gcp_cred_kind }}"
106 service_account_file: "{{ gcp_cred_file | default(omit) }}"
107 scopes:
108 - https://www.googleapis.com/auth/sqlservice.admin
109 register: results
110 - name: Verify that command succeeded
111 ansible.builtin.assert:
112 that:
113 - results['resources'] | map(attribute='name') | select("match", ".*{{ resource_name }}-2.*") | list | length == 0
114 # ----------------------------------------------------------------------------
115 - name: Delete a instance that does not exist
116 google.cloud.gcp_sql_instance:
117 name: "{{ resource_name }}-2"
118 settings:
119 ip_configuration:
120 authorized_networks:
121 - name: google dns server
122 value: 8.8.8.8/32
123 tier: db-n1-standard-1
124 region: us-central1
125 project: "{{ gcp_project }}"
126 auth_kind: "{{ gcp_cred_kind }}"
127 service_account_file: "{{ gcp_cred_file | default(omit) }}"
128 state: absent
129 register: result
130 - name: Assert changed is false
131 ansible.builtin.assert:
132 that:
133 - result.changed == false