From de01872e7cf1764b12868cd1bfaa2a56d484f825 Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 3 Jan 2020 12:35:40 -0800 Subject: [PATCH] Bug fixes for GCP modules (#65792) --- .../modules/cloud/google/gcp_compute_route.py | 29 +++++++++++++++++++ .../cloud/google/gcp_compute_route_info.py | 10 +++++++ 2 files changed, 39 insertions(+) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 8fb774c0698..ae98a4c42e1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -147,6 +147,22 @@ options: to "{{ name-of-resource }}"' required: false type: dict + next_hop_ilb: + description: + - The URL to a forwarding rule of type loadBalancingScheme=INTERNAL that should + handle matching packets. + - 'You can only specify the forwarding rule as a partial or full URL. For example, + the following are all valid URLs: U(https://www.googleapis.com/compute/v1/projects/project/regions/region/forwardingRules/forwardingRule) + regions/region/forwardingRules/forwardingRule Note that this can only be used + when the destinationRange is a public (non-RFC 1918) IP CIDR range.' + - 'This field represents a link to a ForwardingRule resource in GCP. It can 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_forwarding_rule task and then set this next_hop_ilb + field to "{{ name-of-resource }}"' + required: false + type: dict + version_added: '2.10' project: description: - The Google Cloud Platform project to use. @@ -298,6 +314,16 @@ nextHopNetwork: - URL to a Network that should handle matching packets. returned: success type: str +nextHopIlb: + description: + - The URL to a forwarding rule of type loadBalancingScheme=INTERNAL that should + handle matching packets. + - 'You can only specify the forwarding rule as a partial or full URL. For example, + the following are all valid URLs: U(https://www.googleapis.com/compute/v1/projects/project/regions/region/forwardingRules/forwardingRule) + regions/region/forwardingRules/forwardingRule Note that this can only be used + when the destinationRange is a public (non-RFC 1918) IP CIDR range.' + returned: success + type: dict ''' ################################################################################ @@ -329,6 +355,7 @@ def main(): next_hop_instance=dict(type='dict'), next_hop_ip=dict(type='str'), next_hop_vpn_tunnel=dict(type='dict'), + next_hop_ilb=dict(type='dict'), ) ) @@ -391,6 +418,7 @@ def resource_to_request(module): u'nextHopInstance': replace_resource_dict(module.params.get(u'next_hop_instance', {}), 'selfLink'), u'nextHopIp': module.params.get('next_hop_ip'), u'nextHopVpnTunnel': replace_resource_dict(module.params.get(u'next_hop_vpn_tunnel', {}), 'selfLink'), + u'nextHopIlb': replace_resource_dict(module.params.get(u'next_hop_ilb', {}), 'selfLink'), } return_vals = {} for k, v in request.items(): @@ -467,6 +495,7 @@ def response_to_hash(module, response): u'nextHopIp': module.params.get('next_hop_ip'), u'nextHopVpnTunnel': replace_resource_dict(module.params.get(u'next_hop_vpn_tunnel', {}), 'selfLink'), u'nextHopNetwork': response.get(u'nextHopNetwork'), + u'nextHopIlb': replace_resource_dict(module.params.get(u'next_hop_ilb', {}), 'selfLink'), } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route_info.py b/lib/ansible/modules/cloud/google/gcp_compute_route_info.py index 6872ea4e9ab..e46fd875e37 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route_info.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route_info.py @@ -185,6 +185,16 @@ resources: - URL to a Network that should handle matching packets. returned: success type: str + nextHopIlb: + description: + - The URL to a forwarding rule of type loadBalancingScheme=INTERNAL that should + handle matching packets. + - 'You can only specify the forwarding rule as a partial or full URL. For example, + the following are all valid URLs: U(https://www.googleapis.com/compute/v1/projects/project/regions/region/forwardingRules/forwardingRule) + regions/region/forwardingRules/forwardingRule Note that this can only be used + when the destinationRange is a public (non-RFC 1918) IP CIDR range.' + returned: success + type: dict ''' ################################################################################