--- # ---------------------------------------------------------------------------- # # *** AUTO GENERATED CODE *** Type: MMv1 *** # # ---------------------------------------------------------------------------- # # This file is automatically generated by Magic Modules and manual # changes will be clobbered when the file is regenerated. # # Please read more about how to change this file at # https://www.github.com/GoogleCloudPlatform/magic-modules # # ---------------------------------------------------------------------------- # Pre-test setup - name: create a instance google.cloud.gcp_sql_instance: name: "{{resource_name}}-2" settings: ip_configuration: authorized_networks: - name: google dns server value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: instance - name: delete a SSL cert google.cloud.gcp_sql_ssl_cert: common_name: "{{resource_name}}" instance: "{{instance['name'}}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent #---------------------------------------------------------- - name: create a SSL cert google.cloud.gcp_sql_ssl_cert: common_name: "{{resource_name}}" instance: "{{instance['name'}}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: present register: result - name: assert changed is false assert: that: # SslCert is not altered, just verified. - result.changed == false - name: verify that ssl_cert was created google.cloud.gcp_sql_ssl_cert_info: filters: - name = instance: "{{instance['name'}}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" scopes: - https://www.googleapis.com/auth/sqlservice.admin register: results - name: verify that command succeeded assert: that: - results['resources'] | length == 1 #--------------------------------------------------------- # Post-test teardown # If errors happen, don't crash the playbook! - name: delete a instance google.cloud.gcp_sql_instance: name: "{{resource_name}}-2" settings: ip_configuration: authorized_networks: - name: google dns server value: 8.8.8.8/32 tier: db-n1-standard-1 region: us-central1 project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file | default(omit) }}" state: absent register: instance ignore_errors: true