From 9c530e9a9f4f82709b5b5b45fec3ea1f723d22df Mon Sep 17 00:00:00 2001 From: Dana Hoffman Date: Sat, 29 Dec 2018 01:05:05 +0000 Subject: [PATCH] add vpntunnel resourcerefs --- lib/ansible/modules/cloud/google/gcp_compute_route.py | 10 +++++++--- .../cloud/google/gcp_compute_target_vpn_gateway.py | 5 +++-- .../google/gcp_compute_target_vpn_gateway_facts.py | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_route.py b/lib/ansible/modules/cloud/google/gcp_compute_route.py index 6638bf663a2234..b0c6d43d2249fe 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_route.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_route.py @@ -125,6 +125,10 @@ next_hop_vpn_tunnel: description: - URL to a VpnTunnel that should handle matching packets. + - 'This field represents a link to a VpnTunnel 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_vpn_tunnel + task and then set this next_hop_vpn_tunnel field to "{{ name-of-resource }}"' required: false extends_documentation_fragment: gcp notes: @@ -261,7 +265,7 @@ def main(): next_hop_gateway=dict(type='str'), next_hop_instance=dict(type='str'), next_hop_ip=dict(type='str'), - next_hop_vpn_tunnel=dict(type='str') + next_hop_vpn_tunnel=dict() ) ) @@ -322,7 +326,7 @@ def resource_to_request(module): u'nextHopGateway': module.params.get('next_hop_gateway'), u'nextHopInstance': module.params.get('next_hop_instance'), u'nextHopIp': module.params.get('next_hop_ip'), - u'nextHopVpnTunnel': module.params.get('next_hop_vpn_tunnel') + u'nextHopVpnTunnel': replace_resource_dict(module.params.get(u'next_hop_vpn_tunnel', {}), 'selfLink') } return_vals = {} for k, v in request.items(): @@ -397,7 +401,7 @@ def response_to_hash(module, response): u'nextHopGateway': module.params.get('next_hop_gateway'), u'nextHopInstance': module.params.get('next_hop_instance'), u'nextHopIp': module.params.get('next_hop_ip'), - u'nextHopVpnTunnel': module.params.get('next_hop_vpn_tunnel'), + u'nextHopVpnTunnel': replace_resource_dict(module.params.get(u'next_hop_vpn_tunnel', {}), 'selfLink'), u'nextHopNetwork': response.get(u'nextHopNetwork') } diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py index f54c3f6c468e4d..a9a9c9218e3bd0 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway.py @@ -143,12 +143,13 @@ type: str tunnels: description: - - A list of references to VpnTunnel resources associated to this VPN gateway. + - A list of references to VpnTunnel resources associated with this VPN gateway. returned: success type: list forwardingRules: description: - - A list of references to the ForwardingRule resources associated to this VPN gateway. + - A list of references to the ForwardingRule resources associated with this VPN + gateway. returned: success type: list region: diff --git a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py index 47a5ebb8a9058f..b31ede95fb9021 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_target_vpn_gateway_facts.py @@ -102,13 +102,13 @@ type: str tunnels: description: - - A list of references to VpnTunnel resources associated to this VPN gateway. + - A list of references to VpnTunnel resources associated with this VPN gateway. returned: success type: list forwardingRules: description: - - A list of references to the ForwardingRule resources associated to this VPN - gateway. + - A list of references to the ForwardingRule resources associated with this + VPN gateway. returned: success type: list region: