From 56179ad8ef1927b9fd9dbacbb59186d61a8c6da9 Mon Sep 17 00:00:00 2001 From: The Magician Date: Wed, 3 Apr 2019 10:31:59 -0700 Subject: [PATCH] Bug fixes for GCP modules (#54761) --- .../cloud/google/gcp_compute_address.py | 11 +- .../cloud/google/gcp_compute_address_facts.py | 2 +- .../google/gcp_compute_backend_service.py | 109 ++++++++++-------- .../gcp_compute_backend_service_facts.py | 21 ++-- .../modules/cloud/google/gcp_compute_disk.py | 11 +- .../cloud/google/gcp_compute_disk_facts.py | 2 +- .../cloud/google/gcp_compute_firewall.py | 11 +- .../google/gcp_compute_firewall_facts.py | 2 +- .../google/gcp_compute_forwarding_rule.py | 45 ++++---- .../gcp_compute_forwarding_rule_facts.py | 8 +- .../gcp_compute_global_forwarding_rule.py | 34 +++--- ...cp_compute_global_forwarding_rule_facts.py | 6 +- 12 files changed, 146 insertions(+), 116 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address.py b/lib/ansible/modules/cloud/google/gcp_compute_address.py index 1c2054a1b6e..df536ed6919 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address.py @@ -101,9 +101,10 @@ options: - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_subnetwork task and then set this subnetwork field to "{{ name-of-resource + }}"' required: false version_added: 2.7 region: @@ -181,7 +182,7 @@ subnetwork: - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. returned: success - type: str + type: dict users: description: - The URLs of the resources that are using this address. @@ -219,7 +220,7 @@ def main(): description=dict(type='str'), name=dict(required=True, type='str'), network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']), - subnetwork=dict(), + subnetwork=dict(type='dict'), region=dict(required=True, type='str'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py index a6a3d67f1bf..4ad4457577c 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_address_facts.py @@ -122,7 +122,7 @@ items: - This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes. returned: success - type: str + type: dict users: description: - The URLs of the resources that are using this address. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py index f528e06882b..efb31664a56 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service.py @@ -67,6 +67,7 @@ options: Valid values are UTILIZATION, RATE (for HTTP(S)) and CONNECTION (for TCP/SSL). - This cannot be used for internal load balancing. required: false + default: UTILIZATION choices: - UTILIZATION - RATE @@ -81,6 +82,7 @@ options: [0.0,1.0]. - This cannot be used for internal load balancing. required: false + default: '1.0' description: description: - An optional description of this resource. @@ -96,10 +98,10 @@ options: - When the BackendService has load balancing scheme INTERNAL, the instance group must be in a zone within the same region as the BackendService. - 'This field represents a link to a InstanceGroup resource in GCP. It can - be specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` - to a gcp_compute_instance_group task and then set this group field to "{{ - name-of-resource }}"' + be specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_instance_group task and then set this + group field to "{{ name-of-resource }}"' required: false max_connections: description: @@ -140,6 +142,7 @@ options: target for the group. The default is 0.8. Valid range is [0.0, 1.0]. - This cannot be used for internal load balancing. required: false + default: '0.8' cdn_policy: description: - Cloud CDN configuration for this BackendService. @@ -196,7 +199,7 @@ options: version_added: 2.8 connection_draining: description: - - Settings for connection draining. + - Settings for connection draining . required: false suboptions: draining_timeout_sec: @@ -204,6 +207,7 @@ options: - Time for which instance will be drained (not accept new connections, but still work to finish started). required: false + default: '300' description: description: - An optional description of this resource. @@ -221,7 +225,7 @@ options: and a health check is required. - For internal load balancing, a URL to a HealthCheck resource must be specified instead. - required: false + required: true iap: description: - Settings for enabling Cloud Identity Aware Proxy. @@ -235,12 +239,12 @@ options: type: bool oauth2_client_id: description: - - OAuth2 Client ID for IAP. - required: false + - OAuth2 Client ID for IAP . + required: true oauth2_client_secret: description: - - OAuth2 Client Secret for IAP. - required: false + - OAuth2 Client Secret for IAP . + required: true load_balancing_scheme: description: - Indicates whether the backend service will be used with internal or external @@ -259,7 +263,7 @@ options: which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. - required: false + required: true port_name: description: - Name of backend port. The same name should appear in the instance groups referenced @@ -278,11 +282,11 @@ options: - HTTPS - TCP - SSL - region: + security_policy: description: - - The region where the regional backend service resides. - - This field is not applicable to global backend services. + - The security policy associated with this backend service. required: false + version_added: 2.8 session_affinity: description: - Type of session affinity to use. The default is NONE. @@ -394,7 +398,7 @@ backends: - When the BackendService has load balancing scheme INTERNAL, the instance group must be in a zone within the same region as the BackendService. returned: success - type: str + type: dict maxConnections: description: - The max number of simultaneous connections for the group. Can be used with @@ -498,7 +502,7 @@ cdnPolicy: type: int connectionDraining: description: - - Settings for connection draining. + - Settings for connection draining . returned: success type: complex contains: @@ -513,6 +517,12 @@ creationTimestamp: - Creation timestamp in RFC3339 text format. returned: success type: str +fingerprint: + description: + - Fingerprint of this resource. A hash of the contents stored in this object. This + field is used in optimistic locking. + returned: success + type: str description: description: - An optional description of this resource. @@ -551,17 +561,17 @@ iap: type: bool oauth2ClientId: description: - - OAuth2 Client ID for IAP. + - OAuth2 Client ID for IAP . returned: success type: str oauth2ClientSecret: description: - - OAuth2 Client Secret for IAP. + - OAuth2 Client Secret for IAP . returned: success type: str oauth2ClientSecretSha256: description: - - OAuth2 Client Secret SHA-256 for IAP. + - OAuth2 Client Secret SHA-256 for IAP . returned: success type: str loadBalancingScheme: @@ -596,10 +606,9 @@ protocol: is TCP. returned: success type: str -region: +securityPolicy: description: - - The region where the regional backend service resides. - - This field is not applicable to global backend services. + - The security policy associated with this backend service. returned: success type: str sessionAffinity: @@ -625,7 +634,6 @@ timeoutSec: from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, remove_nones_from_dict, replace_resource_dict import json -import re import time ################################################################################ @@ -644,15 +652,15 @@ def main(): type='list', elements='dict', options=dict( - balancing_mode=dict(type='str', choices=['UTILIZATION', 'RATE', 'CONNECTION']), - capacity_scaler=dict(type='str'), + balancing_mode=dict(default='UTILIZATION', type='str', choices=['UTILIZATION', 'RATE', 'CONNECTION']), + capacity_scaler=dict(default=1.0, type='str'), description=dict(type='str'), - group=dict(), + group=dict(type='dict'), max_connections=dict(type='int'), max_connections_per_instance=dict(type='int'), max_rate=dict(type='int'), max_rate_per_instance=dict(type='str'), - max_utilization=dict(type='str'), + max_utilization=dict(default=0.8, type='str'), ), ), cdn_policy=dict( @@ -671,16 +679,19 @@ def main(): signed_url_cache_max_age_sec=dict(default=3600, type='int'), ), ), - connection_draining=dict(type='dict', options=dict(draining_timeout_sec=dict(type='int'))), + connection_draining=dict(type='dict', options=dict(draining_timeout_sec=dict(default=300, type='int'))), description=dict(type='str'), enable_cdn=dict(type='bool'), - health_checks=dict(type='list', elements='str'), - iap=dict(type='dict', options=dict(enabled=dict(type='bool'), oauth2_client_id=dict(type='str'), oauth2_client_secret=dict(type='str'))), + health_checks=dict(required=True, type='list', elements='str'), + iap=dict( + type='dict', + options=dict(enabled=dict(type='bool'), oauth2_client_id=dict(required=True, type='str'), oauth2_client_secret=dict(required=True, type='str')), + ), load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']), - name=dict(type='str'), + name=dict(required=True, type='str'), port_name=dict(type='str'), protocol=dict(type='str', choices=['HTTP', 'HTTPS', 'TCP', 'SSL']), - region=dict(type='str'), + security_policy=dict(type='str'), session_affinity=dict(type='str', choices=['NONE', 'CLIENT_IP', 'GENERATED_COOKIE', 'CLIENT_IP_PROTO', 'CLIENT_IP_PORT_PROTO']), timeout_sec=dict(type='int', aliases=['timeout_seconds']), ) @@ -698,7 +709,7 @@ def main(): if fetch: if state == 'present': if is_different(module, fetch): - update(module, self_link(module), kind) + update(module, self_link(module), kind, fetch) fetch = fetch_resource(module, self_link(module), kind) changed = True else: @@ -722,11 +733,25 @@ def create(module, link, kind): return wait_for_operation(module, auth.post(link, resource_to_request(module))) -def update(module, link, kind): +def update(module, link, kind, fetch): + update_fields(module, resource_to_request(module), response_to_hash(module, fetch)) auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.put(link, resource_to_request(module))) +def update_fields(module, request, response): + if response.get('securityPolicy') != request.get('securityPolicy'): + security_policy_update(module, request, response) + + +def security_policy_update(module, request, response): + auth = GcpSession(module, 'compute') + auth.post( + ''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/backendServices/{name}/setSecurityPolicy"]).format(**module.params), + {u'securityPolicy': module.params.get('security_policy')}, + ) + + def delete(module, link, kind): auth = GcpSession(module, 'compute') return wait_for_operation(module, auth.delete(link)) @@ -747,7 +772,7 @@ def resource_to_request(module): u'name': module.params.get('name'), u'portName': module.params.get('port_name'), u'protocol': module.params.get('protocol'), - u'region': region_selflink(module.params.get('region'), module.params), + u'securityPolicy': module.params.get('security_policy'), u'sessionAffinity': module.params.get('session_affinity'), u'timeoutSec': module.params.get('timeout_sec'), } @@ -820,30 +845,22 @@ def response_to_hash(module, response): u'cdnPolicy': BackendServiceCdnpolicy(response.get(u'cdnPolicy', {}), module).from_response(), u'connectionDraining': BackendServiceConnectiondraining(response.get(u'connectionDraining', {}), module).from_response(), u'creationTimestamp': response.get(u'creationTimestamp'), + u'fingerprint': response.get(u'fingerprint'), u'description': response.get(u'description'), u'enableCDN': response.get(u'enableCDN'), u'healthChecks': response.get(u'healthChecks'), u'id': response.get(u'id'), u'iap': BackendServiceIap(response.get(u'iap', {}), module).from_response(), u'loadBalancingScheme': response.get(u'loadBalancingScheme'), - u'name': response.get(u'name'), + u'name': module.params.get('name'), u'portName': response.get(u'portName'), u'protocol': response.get(u'protocol'), - u'region': response.get(u'region'), + u'securityPolicy': response.get(u'securityPolicy'), u'sessionAffinity': response.get(u'sessionAffinity'), u'timeoutSec': response.get(u'timeoutSec'), } -def region_selflink(name, params): - if name is None: - return - url = r"https://www.googleapis.com/compute/v1/projects/.*/regions/[a-z1-9\-]*" - if not re.match(url, name): - name = "https://www.googleapis.com/compute/v1/projects/{project}/regions/%s".format(**params) % name - return name - - def async_op_url(module, extra_data=None): if extra_data is None: extra_data = {} diff --git a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py index e7339098bdf..aa8713d91f8 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_backend_service_facts.py @@ -115,7 +115,7 @@ items: - When the BackendService has load balancing scheme INTERNAL, the instance group must be in a zone within the same region as the BackendService. returned: success - type: str + type: dict maxConnections: description: - The max number of simultaneous connections for the group. Can be used @@ -219,7 +219,7 @@ items: type: int connectionDraining: description: - - Settings for connection draining. + - Settings for connection draining . returned: success type: complex contains: @@ -234,6 +234,12 @@ items: - Creation timestamp in RFC3339 text format. returned: success type: str + fingerprint: + description: + - Fingerprint of this resource. A hash of the contents stored in this object. + This field is used in optimistic locking. + returned: success + type: str description: description: - An optional description of this resource. @@ -272,17 +278,17 @@ items: type: bool oauth2ClientId: description: - - OAuth2 Client ID for IAP. + - OAuth2 Client ID for IAP . returned: success type: str oauth2ClientSecret: description: - - OAuth2 Client Secret for IAP. + - OAuth2 Client Secret for IAP . returned: success type: str oauth2ClientSecretSha256: description: - - OAuth2 Client Secret SHA-256 for IAP. + - OAuth2 Client Secret SHA-256 for IAP . returned: success type: str loadBalancingScheme: @@ -317,10 +323,9 @@ items: default is TCP. returned: success type: str - region: + securityPolicy: description: - - The region where the regional backend service resides. - - This field is not applicable to global backend services. + - The security policy associated with this backend service. returned: success type: str sessionAffinity: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk.py b/lib/ansible/modules/cloud/google/gcp_compute_disk.py index a96ca008d18..051683ff4d9 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk.py @@ -163,9 +163,10 @@ options: - The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. - 'This field represents a link to a Snapshot resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_snapshot - task and then set this source_snapshot field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_snapshot task and then set this source_snapshot field to "{{ + name-of-resource }}"' required: false source_snapshot_encryption_key: description: @@ -374,7 +375,7 @@ sourceSnapshot: - The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. returned: success - type: str + type: dict sourceSnapshotEncryptionKey: description: - The customer-supplied encryption key of the source snapshot. Required if the source @@ -441,7 +442,7 @@ def main(): zone=dict(required=True, type='str'), source_image_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))), disk_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))), - source_snapshot=dict(), + source_snapshot=dict(type='dict'), source_snapshot_encryption_key=dict(type='dict', options=dict(raw_key=dict(type='str'), kms_key_name=dict(type='str'))), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py index 0eac0ae6d0a..7d727de17ae 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_disk_facts.py @@ -243,7 +243,7 @@ items: - The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. returned: success - type: str + type: dict sourceSnapshotEncryptionKey: description: - The customer-supplied encryption key of the source snapshot. Required if the diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py index ab70325e203..082d6972fde 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall.py @@ -146,9 +146,10 @@ options: networks/my-network projects/myproject/global/networks/my-network global/networks/default .' - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_network task and then set this network field to "{{ name-of-resource + }}"' required: false default: selfLink: global/networks/default @@ -341,7 +342,7 @@ network: networks/my-network projects/myproject/global/networks/my-network global/networks/default .' returned: success - type: str + type: dict priority: description: - Priority for this rule. This is an integer between 0 and 65535, both inclusive. @@ -433,7 +434,7 @@ def main(): direction=dict(type='str', choices=['INGRESS', 'EGRESS']), disabled=dict(type='bool'), name=dict(required=True, type='str'), - network=dict(default=dict(selfLink='global/networks/default')), + network=dict(default=dict(selfLink='global/networks/default'), type='dict'), priority=dict(default=1000, type='int'), source_ranges=dict(type='list', elements='str'), source_service_accounts=dict(type='list', elements='str'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py index ecc39b5aac9..6c266d3d00f 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_firewall_facts.py @@ -170,7 +170,7 @@ items: networks/my-network projects/myproject/global/networks/my-network global/networks/default .' returned: success - type: str + type: dict priority: description: - Priority for this rule. This is an integer between 0 and 65535, both inclusive. diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py index 7813b2b8802..d00485470fc 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule.py @@ -95,10 +95,10 @@ options: - This is used for internal load balancing. - "(not used for external load balancing) ." - 'This field represents a link to a BackendService resource in GCP. It can be - specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` to - a gcp_compute_backend_service task and then set this backend_service field to - "{{ name-of-resource }}"' + specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_backend_service task and then set this backend_service + field to "{{ name-of-resource }}"' required: false ip_version: description: @@ -135,9 +135,10 @@ options: specified, the default network will be used. - This field is not used for external load balancing. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_network task and then set this network field to "{{ name-of-resource + }}"' required: false port_range: description: @@ -170,9 +171,10 @@ options: if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_subnetwork task and then set this subnetwork field to "{{ name-of-resource + }}"' required: false target: description: @@ -183,9 +185,10 @@ options: target object. - This field is not used for internal load balancing. - 'This field represents a link to a TargetPool resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_target_pool - task and then set this target field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_target_pool task and then set this target field to "{{ name-of-resource + }}"' required: false version_added: 2.7 all_ports: @@ -317,7 +320,7 @@ backendService: - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success - type: str + type: dict ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are IPV4 @@ -350,7 +353,7 @@ network: the default network will be used. - This field is not used for external load balancing. returned: success - type: str + type: dict portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, @@ -383,7 +386,7 @@ subnetwork: if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. returned: success - type: str + type: dict target: description: - A reference to a TargetPool resource to receive the matched traffic. @@ -393,7 +396,7 @@ target: target object. - This field is not used for internal load balancing. returned: success - type: str + type: dict allPorts: description: - When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit `port`/`port_range` @@ -456,15 +459,15 @@ def main(): description=dict(type='str'), ip_address=dict(type='str'), ip_protocol=dict(type='str', choices=['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP']), - backend_service=dict(), + backend_service=dict(type='dict'), ip_version=dict(type='str', choices=['IPV4', 'IPV6']), load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']), name=dict(required=True, type='str'), - network=dict(), + network=dict(type='dict'), port_range=dict(type='str'), ports=dict(type='list', elements='str'), - subnetwork=dict(), - target=dict(), + subnetwork=dict(type='dict'), + target=dict(type='dict'), all_ports=dict(type='bool'), network_tier=dict(type='str', choices=['PREMIUM', 'STANDARD']), service_label=dict(type='str'), diff --git a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py index d0dce15b518..99f2e16c8df 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_forwarding_rule_facts.py @@ -123,7 +123,7 @@ items: - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success - type: str + type: dict ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are @@ -156,7 +156,7 @@ items: specified, the default network will be used. - This field is not used for external load balancing. returned: success - type: str + type: dict portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, @@ -191,7 +191,7 @@ items: if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. returned: success - type: str + type: dict target: description: - A reference to a TargetPool resource to receive the matched traffic. @@ -201,7 +201,7 @@ items: to the target object. - This field is not used for internal load balancing. returned: success - type: str + type: dict allPorts: description: - When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit `port`/`port_range` diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py index 2f4749a7f6c..e2f6e658849 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule.py @@ -97,10 +97,10 @@ options: - This is used for internal load balancing. - "(not used for external load balancing) ." - 'This field represents a link to a BackendService resource in GCP. It can be - specified in two ways. First, you can place in the selfLink of the resource - here as a string Alternatively, you can add `register: name-of-resource` to - a gcp_compute_backend_service task and then set this backend_service field to - "{{ name-of-resource }}"' + specified in two ways. First, you can place a dictionary with key ''selfLink'' + and value of your resource''s selfLink Alternatively, you can add `register: + name-of-resource` to a gcp_compute_backend_service task and then set this backend_service + field to "{{ name-of-resource }}"' required: false ip_version: description: @@ -137,9 +137,10 @@ options: specified, the default network will be used. - This field is not used for external load balancing. - 'This field represents a link to a Network resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_network - task and then set this network field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_network task and then set this network field to "{{ name-of-resource + }}"' required: false port_range: description: @@ -172,9 +173,10 @@ options: if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. - 'This field represents a link to a Subnetwork resource in GCP. It can be specified - in two ways. First, you can place in the selfLink of the resource here as a - string Alternatively, you can add `register: name-of-resource` to a gcp_compute_subnetwork - task and then set this subnetwork field to "{{ name-of-resource }}"' + in two ways. First, you can place a dictionary with key ''selfLink'' and value + of your resource''s selfLink Alternatively, you can add `register: name-of-resource` + to a gcp_compute_subnetwork task and then set this subnetwork field to "{{ name-of-resource + }}"' required: false target: description: @@ -318,7 +320,7 @@ backendService: - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success - type: str + type: dict ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are IPV4 @@ -351,7 +353,7 @@ network: the default network will be used. - This field is not used for external load balancing. returned: success - type: str + type: dict portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, @@ -384,7 +386,7 @@ subnetwork: if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. returned: success - type: str + type: dict region: description: - A reference to the region where the regional forwarding rule resides. @@ -422,14 +424,14 @@ def main(): description=dict(type='str'), ip_address=dict(type='str'), ip_protocol=dict(type='str', choices=['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP']), - backend_service=dict(), + backend_service=dict(type='dict'), ip_version=dict(type='str', choices=['IPV4', 'IPV6']), load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']), name=dict(required=True, type='str'), - network=dict(), + network=dict(type='dict'), port_range=dict(type='str'), ports=dict(type='list', elements='str'), - subnetwork=dict(), + subnetwork=dict(type='dict'), target=dict(type='str'), ) ) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py index a9bc1652bb1..c41904100e5 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_global_forwarding_rule_facts.py @@ -117,7 +117,7 @@ items: - This is used for internal load balancing. - "(not used for external load balancing) ." returned: success - type: str + type: dict ipVersion: description: - The IP Version that will be used by this forwarding rule. Valid options are @@ -150,7 +150,7 @@ items: specified, the default network will be used. - This field is not used for external load balancing. returned: success - type: str + type: dict portRange: description: - This field is used along with the target field for TargetHttpProxy, TargetHttpsProxy, @@ -185,7 +185,7 @@ items: if the network is in custom subnet mode, a subnetwork must be specified. - This field is not used for external load balancing. returned: success - type: str + type: dict region: description: - A reference to the region where the regional forwarding rule resides.