Bug fixes for GCP modules (#55358)

This commit is contained in:
The Magician 2019-04-29 12:51:10 -07:00 committed by ansibot
parent 50b72ec2b5
commit 164ceb599b
19 changed files with 167 additions and 270 deletions

View file

@ -262,7 +262,8 @@ def create(module, link, kind):
def update(module, link, kind): def update(module, link, kind):
module.fail_json(msg="Address cannot be edited") delete(module, self_link(module), kind)
create(module, collection(module), kind)
def delete(module, link, kind): def delete(module, link, kind):

View file

@ -90,18 +90,21 @@ options:
required: false required: false
group: group:
description: description:
- This instance group defines the list of instances that serve traffic. Member - The fully-qualified URL of an Instance Group or Network Endpoint Group resource.
virtual machine instances from each instance group must live in the same In case of instance group this defines the list of instances that serve
zone as the instance group itself. traffic. Member virtual machine instances from each instance group must
- No two backends in a backend service are allowed to use same Instance Group live in the same zone as the instance group itself. No two backends in a
resource. backend service are allowed to use same Instance Group resource.
- For Network Endpoint Groups this defines list of endpoints. All endpoints
of Network Endpoint Group must be hosted on instances located in the same
zone as the Network Endpoint Group.
- Backend service can not contain mix of Instance Group and Network Endpoint
Group backends.
- Note that you must specify an Instance Group or Network Endpoint Group resource
using the fully-qualified URL, rather than a partial URL.
- When the BackendService has load balancing scheme INTERNAL, the instance - When the BackendService has load balancing scheme INTERNAL, the instance
group must be in a zone within the same region as the BackendService. group must be within the same region as the BackendService. Network Endpoint
- 'This field represents a link to a InstanceGroup resource in GCP. It can Groups are not supported for INTERNAL load balancing scheme.
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 required: false
max_connections: max_connections:
description: description:
@ -391,15 +394,23 @@ backends:
type: str type: str
group: group:
description: description:
- This instance group defines the list of instances that serve traffic. Member - The fully-qualified URL of an Instance Group or Network Endpoint Group resource.
virtual machine instances from each instance group must live in the same zone In case of instance group this defines the list of instances that serve traffic.
as the instance group itself. Member virtual machine instances from each instance group must live in the
- No two backends in a backend service are allowed to use same Instance Group same zone as the instance group itself. No two backends in a backend service
resource. are allowed to use same Instance Group resource.
- For Network Endpoint Groups this defines list of endpoints. All endpoints
of Network Endpoint Group must be hosted on instances located in the same
zone as the Network Endpoint Group.
- Backend service can not contain mix of Instance Group and Network Endpoint
Group backends.
- Note that you must specify an Instance Group or Network Endpoint Group resource
using the fully-qualified URL, rather than a partial URL.
- When the BackendService has load balancing scheme INTERNAL, the instance group - When the BackendService has load balancing scheme INTERNAL, the instance group
must be in a zone within the same region as the BackendService. must be within the same region as the BackendService. Network Endpoint Groups
are not supported for INTERNAL load balancing scheme.
returned: success returned: success
type: dict type: str
maxConnections: maxConnections:
description: description:
- The max number of simultaneous connections for the group. Can be used with - The max number of simultaneous connections for the group. Can be used with
@ -656,7 +667,7 @@ def main():
balancing_mode=dict(default='UTILIZATION', type='str', choices=['UTILIZATION', 'RATE', 'CONNECTION']), balancing_mode=dict(default='UTILIZATION', type='str', choices=['UTILIZATION', 'RATE', 'CONNECTION']),
capacity_scaler=dict(default=1.0, type='str'), capacity_scaler=dict(default=1.0, type='str'),
description=dict(type='str'), description=dict(type='str'),
group=dict(type='dict'), group=dict(type='str'),
max_connections=dict(type='int'), max_connections=dict(type='int'),
max_connections_per_instance=dict(type='int'), max_connections_per_instance=dict(type='int'),
max_rate=dict(type='int'), max_rate=dict(type='int'),
@ -923,7 +934,7 @@ class BackendServiceBackendsArray(object):
u'balancingMode': item.get('balancing_mode'), u'balancingMode': item.get('balancing_mode'),
u'capacityScaler': item.get('capacity_scaler'), u'capacityScaler': item.get('capacity_scaler'),
u'description': item.get('description'), u'description': item.get('description'),
u'group': replace_resource_dict(item.get(u'group', {}), 'selfLink'), u'group': item.get('group'),
u'maxConnections': item.get('max_connections'), u'maxConnections': item.get('max_connections'),
u'maxConnectionsPerInstance': item.get('max_connections_per_instance'), u'maxConnectionsPerInstance': item.get('max_connections_per_instance'),
u'maxRate': item.get('max_rate'), u'maxRate': item.get('max_rate'),

View file

@ -107,15 +107,23 @@ items:
type: str type: str
group: group:
description: description:
- This instance group defines the list of instances that serve traffic. - The fully-qualified URL of an Instance Group or Network Endpoint Group
Member virtual machine instances from each instance group must live in resource. In case of instance group this defines the list of instances
the same zone as the instance group itself. that serve traffic. Member virtual machine instances from each instance
- No two backends in a backend service are allowed to use same Instance group must live in the same zone as the instance group itself. No two
Group resource. backends in a backend service are allowed to use same Instance Group resource.
- For Network Endpoint Groups this defines list of endpoints. All endpoints
of Network Endpoint Group must be hosted on instances located in the same
zone as the Network Endpoint Group.
- Backend service can not contain mix of Instance Group and Network Endpoint
Group backends.
- Note that you must specify an Instance Group or Network Endpoint Group
resource using the fully-qualified URL, rather than a partial URL.
- When the BackendService has load balancing scheme INTERNAL, the instance - When the BackendService has load balancing scheme INTERNAL, the instance
group must be in a zone within the same region as the BackendService. group must be within the same region as the BackendService. Network Endpoint
Groups are not supported for INTERNAL load balancing scheme.
returned: success returned: success
type: dict type: str
maxConnections: maxConnections:
description: description:
- The max number of simultaneous connections for the group. Can be used - The max number of simultaneous connections for the group. Can be used

View file

@ -91,9 +91,8 @@ options:
- ICMP - ICMP
backend_service: backend_service:
description: description:
- A reference to a BackendService to receive the matched traffic. - A BackendService to receive the matched traffic. This is used only for INTERNAL
- This is used for internal load balancing. load balancing.
- "(not used for external load balancing) ."
- 'This field represents a link to a BackendService resource in GCP. It can be - 'This field represents a link to a BackendService resource in GCP. It can be
specified in two ways. First, you can place a dictionary with key ''selfLink'' 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: and value of your resource''s selfLink Alternatively, you can add `register:
@ -102,8 +101,7 @@ options:
required: false required: false
ip_version: ip_version:
description: description:
- The IP Version that will be used by this forwarding rule. Valid options are - ipVersion is not a valid field for regional forwarding rules.
IPV4 or IPV6. This can only be specified for a global forwarding rule.
required: false required: false
choices: choices:
- IPV4 - IPV4
@ -133,7 +131,7 @@ options:
- For internal load balancing, this field identifies the network that the load - For internal load balancing, this field identifies the network that the load
balanced IP should belong to for this Forwarding Rule. If this field is not balanced IP should belong to for this Forwarding Rule. If this field is not
specified, the default network will be used. specified, the default network will be used.
- This field is not used for external load balancing. - This field is only used for INTERNAL load balancing.
- 'This field represents a link to a Network resource in GCP. It can be specified - 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. First, you can place a dictionary with key ''selfLink'' and value 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` of your resource''s selfLink Alternatively, you can add `register: name-of-resource`
@ -164,12 +162,10 @@ options:
required: false required: false
subnetwork: subnetwork:
description: description:
- A reference to a subnetwork. - The subnetwork that the load balanced IP should belong to for this Forwarding
- For internal load balancing, this field identifies the subnetwork that the load Rule. This field is only used for INTERNAL load balancing.
balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However, - If the network specified is in auto subnet mode, this field is optional. However,
if the network is in custom subnet mode, a subnetwork must be specified. 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 - 'This field represents a link to a Subnetwork resource in GCP. It can be specified
in two ways. First, you can place a dictionary with key ''selfLink'' and value 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` of your resource''s selfLink Alternatively, you can add `register: name-of-resource`
@ -178,12 +174,10 @@ options:
required: false required: false
target: target:
description: description:
- This field is only used for EXTERNAL load balancing.
- A reference to a TargetPool resource to receive the matched traffic. - A reference to a TargetPool resource to receive the matched traffic.
- For regional forwarding rules, this target must live in the same region as the - This target must live in the same region as the forwarding rule.
forwarding rule. For global forwarding rules, this target must be a global load - The forwarded traffic must be of a type appropriate to the target object.
balancing resource. The forwarded traffic must be of a type appropriate to the
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 - 'This field represents a link to a TargetPool resource in GCP. It can be specified
in two ways. First, you can place a dictionary with key ''selfLink'' and value 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` of your resource''s selfLink Alternatively, you can add `register: name-of-resource`
@ -193,9 +187,10 @@ options:
version_added: 2.7 version_added: 2.7
all_ports: all_ports:
description: description:
- When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit `port`/`port_range` - For internal TCP/UDP load balancing (i.e. load balancing scheme is INTERNAL
and specify this field as `true` to allow packets addressed to any ports to and protocol is TCP/UDP), set this to true to allow packets addressed to any
be forwarded to the backends configured with this forwarding rule. ports to be forwarded to the backends configured with this forwarding rule.
Used with backend service. Cannot be set if port or portRange are set.
required: false required: false
type: bool type: bool
version_added: 2.8 version_added: 2.8
@ -218,7 +213,7 @@ options:
`[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase
letter, and all following characters must be a dash, lowercase letter, or digit, letter, and all following characters must be a dash, lowercase letter, or digit,
except the last character, which cannot be a dash. except the last character, which cannot be a dash.
- This field is only used for internal load balancing. - This field is only used for INTERNAL load balancing.
required: false required: false
version_added: 2.8 version_added: 2.8
region: region:
@ -316,15 +311,13 @@ IPProtocol:
type: str type: str
backendService: backendService:
description: description:
- A reference to a BackendService to receive the matched traffic. - A BackendService to receive the matched traffic. This is used only for INTERNAL
- This is used for internal load balancing. load balancing.
- "(not used for external load balancing) ."
returned: success returned: success
type: dict type: dict
ipVersion: ipVersion:
description: description:
- The IP Version that will be used by this forwarding rule. Valid options are IPV4 - ipVersion is not a valid field for regional forwarding rules.
or IPV6. This can only be specified for a global forwarding rule.
returned: success returned: success
type: str type: str
loadBalancingScheme: loadBalancingScheme:
@ -351,7 +344,7 @@ network:
- For internal load balancing, this field identifies the network that the load balanced - For internal load balancing, this field identifies the network that the load balanced
IP should belong to for this Forwarding Rule. If this field is not specified, IP should belong to for this Forwarding Rule. If this field is not specified,
the default network will be used. the default network will be used.
- This field is not used for external load balancing. - This field is only used for INTERNAL load balancing.
returned: success returned: success
type: dict type: dict
portRange: portRange:
@ -379,29 +372,26 @@ ports:
type: list type: list
subnetwork: subnetwork:
description: description:
- A reference to a subnetwork. - The subnetwork that the load balanced IP should belong to for this Forwarding
- For internal load balancing, this field identifies the subnetwork that the load Rule. This field is only used for INTERNAL load balancing.
balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However, - If the network specified is in auto subnet mode, this field is optional. However,
if the network is in custom subnet mode, a subnetwork must be specified. if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
returned: success returned: success
type: dict type: dict
target: target:
description: description:
- This field is only used for EXTERNAL load balancing.
- A reference to a TargetPool resource to receive the matched traffic. - A reference to a TargetPool resource to receive the matched traffic.
- For regional forwarding rules, this target must live in the same region as the - This target must live in the same region as the forwarding rule.
forwarding rule. For global forwarding rules, this target must be a global load - The forwarded traffic must be of a type appropriate to the target object.
balancing resource. The forwarded traffic must be of a type appropriate to the
target object.
- This field is not used for internal load balancing.
returned: success returned: success
type: dict type: dict
allPorts: allPorts:
description: description:
- When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit `port`/`port_range` - For internal TCP/UDP load balancing (i.e. load balancing scheme is INTERNAL and
and specify this field as `true` to allow packets addressed to any ports to be protocol is TCP/UDP), set this to true to allow packets addressed to any ports
forwarded to the backends configured with this forwarding rule. to be forwarded to the backends configured with this forwarding rule. Used with
backend service. Cannot be set if port or portRange are set.
returned: success returned: success
type: bool type: bool
networkTier: networkTier:
@ -420,13 +410,13 @@ serviceLabel:
`[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase
letter, and all following characters must be a dash, lowercase letter, or digit, letter, and all following characters must be a dash, lowercase letter, or digit,
except the last character, which cannot be a dash. except the last character, which cannot be a dash.
- This field is only used for internal load balancing. - This field is only used for INTERNAL load balancing.
returned: success returned: success
type: str type: str
serviceName: serviceName:
description: description:
- The internal fully qualified service name for this Forwarding Rule. - The internal fully qualified service name for this Forwarding Rule.
- This field is only used for internal load balancing. - This field is only used for INTERNAL load balancing.
returned: success returned: success
type: str type: str
region: region:

View file

@ -119,15 +119,13 @@ items:
type: str type: str
backendService: backendService:
description: description:
- A reference to a BackendService to receive the matched traffic. - A BackendService to receive the matched traffic. This is used only for INTERNAL
- This is used for internal load balancing. load balancing.
- "(not used for external load balancing) ."
returned: success returned: success
type: dict type: dict
ipVersion: ipVersion:
description: description:
- The IP Version that will be used by this forwarding rule. Valid options are - ipVersion is not a valid field for regional forwarding rules.
IPV4 or IPV6. This can only be specified for a global forwarding rule.
returned: success returned: success
type: str type: str
loadBalancingScheme: loadBalancingScheme:
@ -154,7 +152,7 @@ items:
- For internal load balancing, this field identifies the network that the load - For internal load balancing, this field identifies the network that the load
balanced IP should belong to for this Forwarding Rule. If this field is not balanced IP should belong to for this Forwarding Rule. If this field is not
specified, the default network will be used. specified, the default network will be used.
- This field is not used for external load balancing. - This field is only used for INTERNAL load balancing.
returned: success returned: success
type: dict type: dict
portRange: portRange:
@ -184,29 +182,26 @@ items:
type: list type: list
subnetwork: subnetwork:
description: description:
- A reference to a subnetwork. - The subnetwork that the load balanced IP should belong to for this Forwarding
- For internal load balancing, this field identifies the subnetwork that the Rule. This field is only used for INTERNAL load balancing.
load balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However, - If the network specified is in auto subnet mode, this field is optional. However,
if the network is in custom subnet mode, a subnetwork must be specified. if the network is in custom subnet mode, a subnetwork must be specified.
- This field is not used for external load balancing.
returned: success returned: success
type: dict type: dict
target: target:
description: description:
- This field is only used for EXTERNAL load balancing.
- A reference to a TargetPool resource to receive the matched traffic. - A reference to a TargetPool resource to receive the matched traffic.
- For regional forwarding rules, this target must live in the same region as - This target must live in the same region as the forwarding rule.
the forwarding rule. For global forwarding rules, this target must be a global - The forwarded traffic must be of a type appropriate to the target object.
load balancing resource. The forwarded traffic must be of a type appropriate
to the target object.
- This field is not used for internal load balancing.
returned: success returned: success
type: dict type: dict
allPorts: allPorts:
description: description:
- When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit `port`/`port_range` - For internal TCP/UDP load balancing (i.e. load balancing scheme is INTERNAL
and specify this field as `true` to allow packets addressed to any ports to and protocol is TCP/UDP), set this to true to allow packets addressed to any
be forwarded to the backends configured with this forwarding rule. ports to be forwarded to the backends configured with this forwarding rule.
Used with backend service. Cannot be set if port or portRange are set.
returned: success returned: success
type: bool type: bool
networkTier: networkTier:
@ -225,13 +220,13 @@ items:
expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must
be a lowercase letter, and all following characters must be a dash, lowercase 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. letter, or digit, except the last character, which cannot be a dash.
- This field is only used for internal load balancing. - This field is only used for INTERNAL load balancing.
returned: success returned: success
type: str type: str
serviceName: serviceName:
description: description:
- The internal fully qualified service name for this Forwarding Rule. - The internal fully qualified service name for this Forwarding Rule.
- This field is only used for internal load balancing. - This field is only used for INTERNAL load balancing.
returned: success returned: success
type: str type: str
region: region:

View file

@ -217,7 +217,8 @@ def create(module, link, kind):
def update(module, link, kind): def update(module, link, kind):
module.fail_json(msg="GlobalAddress cannot be edited") delete(module, self_link(module), kind)
create(module, collection(module), kind)
def delete(module, link, kind): def delete(module, link, kind):

View file

@ -81,8 +81,8 @@ options:
ip_protocol: ip_protocol:
description: description:
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP,
AH, SCTP or ICMP. AH, SCTP or ICMP. When the load balancing scheme is INTERNAL_SELF_MANAGED, only
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid. TCP is valid.
required: false required: false
choices: choices:
- TCP - TCP
@ -91,35 +91,24 @@ options:
- AH - AH
- SCTP - SCTP
- ICMP - ICMP
backend_service:
description:
- A reference to a BackendService to receive the matched traffic.
- 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 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: ip_version:
description: description:
- The IP Version that will be used by this forwarding rule. Valid options are - The IP Version that will be used by this global forwarding rule.
IPV4 or IPV6. This can only be specified for a global forwarding rule. - Valid options are IPV4 or IPV6.
required: false required: false
choices: choices:
- IPV4 - IPV4
- IPV6 - IPV6
load_balancing_scheme: load_balancing_scheme:
description: description:
- 'This signifies what the ForwardingRule will be used for and can only take the - This signifies what the GlobalForwardingRule will be used for.
following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will - 'The value of INTERNAL_SELF_MANAGED means that this will be used for Internal
be used for Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL Global HTTP(S) LB. The value of EXTERNAL means that this will be used for External
means that this will be used for External Load Balancing (HTTP(S) LB, External Global Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy) NOTE: Currently
TCP/UDP LB, SSL Proxy) .' global forwarding rules cannot be used for INTERNAL load balancing.'
required: false required: false
choices: choices:
- INTERNAL - INTERNAL_SELF_MANAGED
- EXTERNAL - EXTERNAL
name: name:
description: description:
@ -132,10 +121,10 @@ options:
required: true required: true
network: network:
description: description:
- For internal load balancing, this field identifies the network that the load
balanced IP should belong to for this Forwarding Rule. If this field is not
specified, the default network will be used.
- This field is not used for external load balancing. - This field is not used for external load balancing.
- For INTERNAL_SELF_MANAGED load balancing, this field identifies the network
that the load balanced IP should belong to for this global forwarding rule.
If this field is not specified, the default network will be used.
- 'This field represents a link to a Network resource in GCP. It can be specified - 'This field represents a link to a Network resource in GCP. It can be specified
in two ways. First, you can place a dictionary with key ''selfLink'' and value 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` of your resource''s selfLink Alternatively, you can add `register: name-of-resource`
@ -156,34 +145,11 @@ options:
43, 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: 43, 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway:
500, 4500 .' 500, 4500 .'
required: false required: false
ports:
description:
- This field is used along with the backend_service field for internal load balancing.
- When the load balancing scheme is INTERNAL, a single port or a comma separated
list of ports can be configured. Only packets addressed to these ports will
be forwarded to the backends configured with this forwarding rule.
- You may specify a maximum of up to 5 ports.
required: false
subnetwork:
description:
- A reference to a subnetwork.
- For internal load balancing, this field identifies the subnetwork that the load
balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However,
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 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: target:
description: description:
- This target must be a global load balancing resource. The forwarded traffic - The URL of the target resource to receive the matched traffic.
must be of a type appropriate to the target object. - The forwarded traffic must be of a type appropriate to the target object.
- 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .' required: true
required: false
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''
@ -310,30 +276,23 @@ IPAddress:
IPProtocol: IPProtocol:
description: description:
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH, - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH,
SCTP or ICMP. SCTP or ICMP. When the load balancing scheme is INTERNAL_SELF_MANAGED, only TCP
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid. is valid.
returned: success returned: success
type: str type: str
backendService:
description:
- A reference to a BackendService to receive the matched traffic.
- This is used for internal load balancing.
- "(not used for external load balancing) ."
returned: success
type: dict
ipVersion: ipVersion:
description: description:
- The IP Version that will be used by this forwarding rule. Valid options are IPV4 - The IP Version that will be used by this global forwarding rule.
or IPV6. This can only be specified for a global forwarding rule. - Valid options are IPV4 or IPV6.
returned: success returned: success
type: str type: str
loadBalancingScheme: loadBalancingScheme:
description: description:
- 'This signifies what the ForwardingRule will be used for and can only take the - This signifies what the GlobalForwardingRule will be used for.
following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will - 'The value of INTERNAL_SELF_MANAGED means that this will be used for Internal
be used for Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL Global HTTP(S) LB. The value of EXTERNAL means that this will be used for External
means that this will be used for External Load Balancing (HTTP(S) LB, External Global Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy) NOTE: Currently
TCP/UDP LB, SSL Proxy) .' global forwarding rules cannot be used for INTERNAL load balancing.'
returned: success returned: success
type: str type: str
name: name:
@ -348,10 +307,10 @@ name:
type: str type: str
network: network:
description: description:
- For internal load balancing, this field identifies the network that the load balanced
IP should belong to for this Forwarding Rule. If this field is not specified,
the default network will be used.
- This field is not used for external load balancing. - This field is not used for external load balancing.
- For INTERNAL_SELF_MANAGED load balancing, this field identifies the network that
the load balanced IP should belong to for this global forwarding rule. If this
field is not specified, the default network will be used.
returned: success returned: success
type: dict type: dict
portRange: portRange:
@ -368,36 +327,10 @@ portRange:
465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: 500, 4500 .' 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: 500, 4500 .'
returned: success returned: success
type: str type: str
ports:
description:
- This field is used along with the backend_service field for internal load balancing.
- When the load balancing scheme is INTERNAL, a single port or a comma separated
list of ports can be configured. Only packets addressed to these ports will be
forwarded to the backends configured with this forwarding rule.
- You may specify a maximum of up to 5 ports.
returned: success
type: list
subnetwork:
description:
- A reference to a subnetwork.
- For internal load balancing, this field identifies the subnetwork that the load
balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However,
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: dict
region:
description:
- A reference to the region where the regional forwarding rule resides.
- This field is not applicable to global forwarding rules.
returned: success
type: str
target: target:
description: description:
- This target must be a global load balancing resource. The forwarded traffic must - The URL of the target resource to receive the matched traffic.
be of a type appropriate to the target object. - The forwarded traffic must be of a type appropriate to the target object.
- 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .'
returned: success returned: success
type: str type: str
''' '''
@ -424,15 +357,12 @@ def main():
description=dict(type='str'), description=dict(type='str'),
ip_address=dict(type='str'), ip_address=dict(type='str'),
ip_protocol=dict(type='str', choices=['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP']), ip_protocol=dict(type='str', choices=['TCP', 'UDP', 'ESP', 'AH', 'SCTP', 'ICMP']),
backend_service=dict(type='dict'),
ip_version=dict(type='str', choices=['IPV4', 'IPV6']), ip_version=dict(type='str', choices=['IPV4', 'IPV6']),
load_balancing_scheme=dict(type='str', choices=['INTERNAL', 'EXTERNAL']), load_balancing_scheme=dict(type='str', choices=['INTERNAL_SELF_MANAGED', 'EXTERNAL']),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
network=dict(type='dict'), network=dict(type='dict'),
port_range=dict(type='str'), port_range=dict(type='str'),
ports=dict(type='list', elements='str'), target=dict(required=True, type='str'),
subnetwork=dict(type='dict'),
target=dict(type='str'),
) )
) )
@ -448,7 +378,7 @@ def main():
if fetch: if fetch:
if state == 'present': if state == 'present':
if is_different(module, fetch): 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) fetch = fetch_resource(module, self_link(module), kind)
changed = True changed = True
else: else:
@ -472,9 +402,22 @@ def create(module, link, kind):
return wait_for_operation(module, auth.post(link, resource_to_request(module))) 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))
return fetch_resource(module, self_link(module), kind)
def update_fields(module, request, response):
if response.get('target') != request.get('target'):
target_update(module, request, response)
def target_update(module, request, response):
auth = GcpSession(module, 'compute') auth = GcpSession(module, 'compute')
return wait_for_operation(module, auth.put(link, resource_to_request(module))) auth.post(
''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/global/forwardingRules/{name}/setTarget"]).format(**module.params),
{u'target': module.params.get('target')},
)
def delete(module, link, kind): def delete(module, link, kind):
@ -488,14 +431,11 @@ def resource_to_request(module):
u'description': module.params.get('description'), u'description': module.params.get('description'),
u'IPAddress': module.params.get('ip_address'), u'IPAddress': module.params.get('ip_address'),
u'IPProtocol': module.params.get('ip_protocol'), u'IPProtocol': module.params.get('ip_protocol'),
u'backendService': replace_resource_dict(module.params.get(u'backend_service', {}), 'selfLink'),
u'ipVersion': module.params.get('ip_version'), u'ipVersion': module.params.get('ip_version'),
u'loadBalancingScheme': module.params.get('load_balancing_scheme'), u'loadBalancingScheme': module.params.get('load_balancing_scheme'),
u'name': module.params.get('name'), u'name': module.params.get('name'),
u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'), u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'),
u'portRange': module.params.get('port_range'), u'portRange': module.params.get('port_range'),
u'ports': module.params.get('ports'),
u'subnetwork': replace_resource_dict(module.params.get(u'subnetwork', {}), 'selfLink'),
u'target': module.params.get('target'), u'target': module.params.get('target'),
} }
return_vals = {} return_vals = {}
@ -567,15 +507,11 @@ def response_to_hash(module, response):
u'id': response.get(u'id'), u'id': response.get(u'id'),
u'IPAddress': response.get(u'IPAddress'), u'IPAddress': response.get(u'IPAddress'),
u'IPProtocol': response.get(u'IPProtocol'), u'IPProtocol': response.get(u'IPProtocol'),
u'backendService': response.get(u'backendService'),
u'ipVersion': response.get(u'ipVersion'), u'ipVersion': response.get(u'ipVersion'),
u'loadBalancingScheme': response.get(u'loadBalancingScheme'), u'loadBalancingScheme': response.get(u'loadBalancingScheme'),
u'name': response.get(u'name'), u'name': response.get(u'name'),
u'network': response.get(u'network'), u'network': response.get(u'network'),
u'portRange': response.get(u'portRange'), u'portRange': response.get(u'portRange'),
u'ports': response.get(u'ports'),
u'subnetwork': response.get(u'subnetwork'),
u'region': response.get(u'region'),
u'target': response.get(u'target'), u'target': response.get(u'target'),
} }

View file

@ -107,30 +107,23 @@ items:
IPProtocol: IPProtocol:
description: description:
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, - The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP,
AH, SCTP or ICMP. AH, SCTP or ICMP. When the load balancing scheme is INTERNAL_SELF_MANAGED,
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid. only TCP is valid.
returned: success returned: success
type: str type: str
backendService:
description:
- A reference to a BackendService to receive the matched traffic.
- This is used for internal load balancing.
- "(not used for external load balancing) ."
returned: success
type: dict
ipVersion: ipVersion:
description: description:
- The IP Version that will be used by this forwarding rule. Valid options are - The IP Version that will be used by this global forwarding rule.
IPV4 or IPV6. This can only be specified for a global forwarding rule. - Valid options are IPV4 or IPV6.
returned: success returned: success
type: str type: str
loadBalancingScheme: loadBalancingScheme:
description: description:
- 'This signifies what the ForwardingRule will be used for and can only take - This signifies what the GlobalForwardingRule will be used for.
the following values: INTERNAL, EXTERNAL The value of INTERNAL means that - 'The value of INTERNAL_SELF_MANAGED means that this will be used for Internal
this will be used for Internal Network Load Balancing (TCP, UDP). The value Global HTTP(S) LB. The value of EXTERNAL means that this will be used for
of EXTERNAL means that this will be used for External Load Balancing (HTTP(S) External Global Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy)
LB, External TCP/UDP LB, SSL Proxy) .' NOTE: Currently global forwarding rules cannot be used for INTERNAL load balancing.'
returned: success returned: success
type: str type: str
name: name:
@ -145,10 +138,10 @@ items:
type: str type: str
network: network:
description: description:
- For internal load balancing, this field identifies the network that the load
balanced IP should belong to for this Forwarding Rule. If this field is not
specified, the default network will be used.
- This field is not used for external load balancing. - This field is not used for external load balancing.
- For INTERNAL_SELF_MANAGED load balancing, this field identifies the network
that the load balanced IP should belong to for this global forwarding rule.
If this field is not specified, the default network will be used.
returned: success returned: success
type: dict type: dict
portRange: portRange:
@ -166,37 +159,10 @@ items:
500, 4500 .' 500, 4500 .'
returned: success returned: success
type: str type: str
ports:
description:
- This field is used along with the backend_service field for internal load
balancing.
- When the load balancing scheme is INTERNAL, a single port or a comma separated
list of ports can be configured. Only packets addressed to these ports will
be forwarded to the backends configured with this forwarding rule.
- You may specify a maximum of up to 5 ports.
returned: success
type: list
subnetwork:
description:
- A reference to a subnetwork.
- For internal load balancing, this field identifies the subnetwork that the
load balanced IP should belong to for this Forwarding Rule.
- If the network specified is in auto subnet mode, this field is optional. However,
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: dict
region:
description:
- A reference to the region where the regional forwarding rule resides.
- This field is not applicable to global forwarding rules.
returned: success
type: str
target: target:
description: description:
- This target must be a global load balancing resource. The forwarded traffic - The URL of the target resource to receive the matched traffic.
must be of a type appropriate to the target object. - The forwarded traffic must be of a type appropriate to the target object.
- 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .'
returned: success returned: success
type: str type: str
''' '''

View file

@ -1,3 +1,2 @@
--- ---
# defaults file resource_name: "{{ resource_prefix }}"
resource_name: '{{resource_prefix}}'

View file

@ -1,3 +1,2 @@
--- ---
# defaults file resource_name: "{{ resource_prefix }}"
resource_name: '{{resource_prefix}}'

View file

@ -1,3 +1,2 @@
--- ---
# defaults file resource_name: "{{ resource_prefix }}"
resource_name: '{{resource_prefix}}'

View file

@ -1,3 +1,2 @@
--- ---
# defaults file resource_name: "{{ resource_prefix }}"
resource_name: '{{resource_prefix}}'

View file

@ -1,3 +1,2 @@
--- ---
# defaults file resource_name: "{{ resource_prefix }}"
resource_name: '{{resource_prefix}}'

View file

@ -1,3 +1,2 @@
--- ---
# defaults file resource_name: "{{ resource_prefix }}"
resource_name: '{{resource_prefix}}'

View file

@ -1,3 +1,2 @@
--- ---
# defaults file resource_name: "{{ resource_prefix }}"
resource_name: '{{resource_prefix}}'

View file

@ -1,3 +1,2 @@
--- ---
# defaults file resource_name: "{{ resource_prefix }}"
resource_name: '{{resource_prefix}}'

View file

@ -1,3 +1,2 @@
--- ---
# defaults file resource_name: "{{ resource_prefix }}"
resource_name: '{{resource_prefix}}'

View file

@ -1,3 +1,2 @@
--- ---
# defaults file resource_name: "{{ resource_prefix }}"
resource_name: '{{resource_prefix}}'

View file

@ -1,3 +1,2 @@
--- ---
# defaults file resource_name: "{{ resource_prefix }}"
resource_name: '{{resource_prefix}}'