diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index 5965e9931f7923..5ab9da55a13934 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -598,7 +598,7 @@ def response_to_hash(module, response): def disk_type_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/{zone}/diskTypes/[a-z1-9\-]*" + url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/[a-z1-9\-]*/diskTypes/[a-z1-9\-]*" if not re.match(url, name): name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/diskTypes/%s".format(**params) % name return name diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index afa8b187e63a70..4588a55ed2a908 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -1051,7 +1051,7 @@ def response_to_hash(module, response): def disk_type_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/{zone}/diskTypes/[a-z1-9\-]*" + url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/[a-z1-9\-]*/diskTypes/[a-z1-9\-]*" if not re.match(url, name): name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/diskTypes/%s".format(**params) % name return name @@ -1060,7 +1060,7 @@ def disk_type_selflink(name, params): def machine_type_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/{zone}/machineTypes/[a-z1-9\-]*" + url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/[a-z1-9\-]*/machineTypes/[a-z1-9\-]*" if not re.match(url, name): name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/machineTypes/%s".format(**params) % name return name diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py index 751d495de8a724..11fc872452b8e9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance_template.py @@ -1002,7 +1002,7 @@ def response_to_hash(module, response): def disk_type_selflink(name, params): if name is None: return - url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/{zone}/diskTypes/[a-z1-9\-]*" + url = r"https://www.googleapis.com/compute/v1/projects/.*/zones/[a-z1-9\-]*/diskTypes/[a-z1-9\-]*" if not re.match(url, name): name = "https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/diskTypes/%s".format(**params) % name return name diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py index 79af7777adf1ba..b4267dc6f3c2f4 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate.py @@ -32,8 +32,9 @@ --- module: gcp_compute_ssl_certificate description: - - An SslCertificate resource. This resource provides a mechanism to upload an SSL - key and certificate to the load balancer to serve secure connections from the user. + - An SslCertificate resource, used for HTTPS load balancing. This resource provides + a mechanism to upload an SSL key and certificate to the load balancer to serve secure + connections from the user. short_description: Creates a GCP SslCertificate version_added: 2.6 author: Google Inc. (@googlecloudplatform) @@ -52,7 +53,7 @@ - The certificate in PEM format. - The certificate chain must be no greater than 5 certs long. - The chain must include at least one intermediate cert. - required: false + required: true description: description: - An optional description of this resource. @@ -68,9 +69,12 @@ required: false private_key: description: - - The private key in PEM format. - required: false + - The write-only private key in PEM format. + required: true extends_documentation_fragment: gcp +notes: + - "API Reference: U(https://cloud.google.com/compute/docs/reference/rest/v1/sslCertificates)" + - "Official Documentation: U(https://cloud.google.com/load-balancing/docs/ssl-certificates)" ''' EXAMPLES = ''' @@ -143,7 +147,7 @@ type: str private_key: description: - - The private key in PEM format. + - The write-only private key in PEM format. returned: success type: str ''' @@ -167,10 +171,10 @@ def main(): module = GcpModule( argument_spec=dict( state=dict(default='present', choices=['present', 'absent'], type='str'), - certificate=dict(type='str'), + certificate=dict(required=True, type='str'), description=dict(type='str'), name=dict(type='str'), - private_key=dict(type='str') + private_key=dict(required=True, type='str') ) ) @@ -210,8 +214,7 @@ def create(module, link, kind): def update(module, link, kind): - auth = GcpSession(module, 'compute') - return wait_for_operation(module, auth.put(link, resource_to_request(module))) + module.fail_json(msg="SslCertificate cannot be edited") def delete(module, link, kind): diff --git a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py index 64696d70d66964..78f50ce30e5227 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_ssl_certificate_facts.py @@ -100,7 +100,7 @@ type: str private_key: description: - - The private key in PEM format. + - The write-only private key in PEM format. returned: success type: str '''