diff --git a/plugins/modules/gcp_dns_resource_record_set_info.py b/plugins/modules/gcp_dns_resource_record_set_info.py index 9ce382c..869e5f6 100644 --- a/plugins/modules/gcp_dns_resource_record_set_info.py +++ b/plugins/modules/gcp_dns_resource_record_set_info.py @@ -123,7 +123,7 @@ def main(): def collection(module): res = {'project': module.params['project'], 'managed_zone': replace_resource_dict(module.params['managed_zone'], 'name')} - return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/changes".format(**res) + return "https://www.googleapis.com/dns/v1/projects/{project}/managedZones/{managed_zone}/rrsets".format(**res) def fetch_list(module, link): diff --git a/plugins/modules/gcp_sql_database.py b/plugins/modules/gcp_sql_database.py index 459c4a9..47eb46d 100644 --- a/plugins/modules/gcp_sql_database.py +++ b/plugins/modules/gcp_sql_database.py @@ -99,7 +99,7 @@ EXAMPLES = ''' gcp_sql_database: name: test_object charset: utf8 - instance: "{{ instance }}" + instance: "{{ instance.name }}" project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" diff --git a/plugins/modules/gcp_sql_database_info.py b/plugins/modules/gcp_sql_database_info.py index 03625ea..f767be8 100644 --- a/plugins/modules/gcp_sql_database_info.py +++ b/plugins/modules/gcp_sql_database_info.py @@ -53,7 +53,7 @@ extends_documentation_fragment: gcp EXAMPLES = ''' - name: get info on a database gcp_sql_database_info: - instance: "{{ instance }}" + instance: "{{ instance.name }}" project: test_project auth_kind: serviceaccount service_account_file: "/tmp/auth.pem" diff --git a/plugins/modules/gcp_storage_bucket_access_control.py b/plugins/modules/gcp_storage_bucket_access_control.py index 6d58a49..37cbc13 100644 --- a/plugins/modules/gcp_storage_bucket_access_control.py +++ b/plugins/modules/gcp_storage_bucket_access_control.py @@ -120,7 +120,7 @@ EXAMPLES = ''' - name: create a bucket access control gcp_storage_bucket_access_control: - bucket: test_object + bucket: "{{ bucket }}" entity: user-alexstephen@google.com role: WRITER project: test_project @@ -220,10 +220,7 @@ def main(): state = module.params['state'] kind = 'storage#bucketAccessControl' - if module.params['id']: - fetch = fetch_resource(module, self_link(module), kind) - else: - fetch = {} + fetch = fetch_resource(module, self_link(module), kind) changed = False if fetch: @@ -286,11 +283,13 @@ def fetch_resource(module, link, kind, allow_not_found=True): def self_link(module): - return "https://www.googleapis.com/storage/v1/b/{bucket}/acl/{entity}".format(**module.params) + res = {'bucket': replace_resource_dict(module.params['bucket'], 'name'), 'entity': module.params['entity']} + return "https://www.googleapis.com/storage/v1/b/{bucket}/acl/{entity}".format(**res) def collection(module): - return "https://www.googleapis.com/storage/v1/b/{bucket}/acl".format(**module.params) + res = {'bucket': replace_resource_dict(module.params['bucket'], 'name')} + return "https://www.googleapis.com/storage/v1/b/{bucket}/acl".format(**res) def return_if_object(module, response, kind, allow_not_found=False): diff --git a/tests/integration/gcp_sql_database/tasks/main.yml b/tests/integration/gcp_sql_database/tasks/main.yml index 0c22c3f..ebe9cbd 100644 --- a/tests/integration/gcp_sql_database/tasks/main.yml +++ b/tests/integration/gcp_sql_database/tasks/main.yml @@ -32,7 +32,7 @@ gcp_sql_database: name: "{{ resource_name }}" charset: utf8 - instance: "{{ instance }}" + instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -42,7 +42,7 @@ gcp_sql_database: name: "{{ resource_name }}" charset: utf8 - instance: "{{ instance }}" + instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -54,7 +54,7 @@ - result.changed == true - name: verify that database was created gcp_sql_database_info: - instance: "{{ instance }}" + instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -70,7 +70,7 @@ gcp_sql_database: name: "{{ resource_name }}" charset: utf8 - instance: "{{ instance }}" + instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -85,7 +85,7 @@ gcp_sql_database: name: "{{ resource_name }}" charset: utf8 - instance: "{{ instance }}" + instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -97,7 +97,7 @@ - result.changed == true - name: verify that database was deleted gcp_sql_database_info: - instance: "{{ instance }}" + instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" @@ -113,7 +113,7 @@ gcp_sql_database: name: "{{ resource_name }}" charset: utf8 - instance: "{{ instance }}" + instance: "{{ instance.name }}" project: "{{ gcp_project }}" auth_kind: "{{ gcp_cred_kind }}" service_account_file: "{{ gcp_cred_file }}" diff --git a/tests/integration/gcp_storage_bucket_access_control/tasks/main.yml b/tests/integration/gcp_storage_bucket_access_control/tasks/main.yml index 301505a..5a78a87 100644 --- a/tests/integration/gcp_storage_bucket_access_control/tasks/main.yml +++ b/tests/integration/gcp_storage_bucket_access_control/tasks/main.yml @@ -23,7 +23,7 @@ register: bucket - name: delete a bucket access control gcp_storage_bucket_access_control: - bucket: "{{ resource_name }}" + bucket: "{{ bucket }}" entity: user-alexstephen@google.com role: WRITER project: "{{ gcp_project }}" @@ -33,7 +33,7 @@ #---------------------------------------------------------- - name: create a bucket access control gcp_storage_bucket_access_control: - bucket: "{{ resource_name }}" + bucket: "{{ bucket }}" entity: user-alexstephen@google.com role: WRITER project: "{{ gcp_project }}" @@ -48,7 +48,7 @@ # ---------------------------------------------------------------------------- - name: create a bucket access control that already exists gcp_storage_bucket_access_control: - bucket: "{{ resource_name }}" + bucket: "{{ bucket }}" entity: user-alexstephen@google.com role: WRITER project: "{{ gcp_project }}" @@ -63,7 +63,7 @@ #---------------------------------------------------------- - name: delete a bucket access control gcp_storage_bucket_access_control: - bucket: "{{ resource_name }}" + bucket: "{{ bucket }}" entity: user-alexstephen@google.com role: WRITER project: "{{ gcp_project }}" @@ -78,7 +78,7 @@ # ---------------------------------------------------------------------------- - name: delete a bucket access control that does not exist gcp_storage_bucket_access_control: - bucket: "{{ resource_name }}" + bucket: "{{ bucket }}" entity: user-alexstephen@google.com role: WRITER project: "{{ gcp_project }}"