Bug fixes for GCP modules (#55358)
This commit is contained in:
parent
50b72ec2b5
commit
164ceb599b
19 changed files with 167 additions and 270 deletions
|
@ -262,7 +262,8 @@ def create(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):
|
||||
|
|
|
@ -90,18 +90,21 @@ options:
|
|||
required: false
|
||||
group:
|
||||
description:
|
||||
- This instance group defines the list of instances that serve traffic. Member
|
||||
virtual machine instances from each instance group must live in the same
|
||||
zone as the instance group itself.
|
||||
- No two backends in a backend service are allowed to use same Instance Group
|
||||
resource.
|
||||
- The fully-qualified URL of an Instance Group or Network Endpoint Group resource.
|
||||
In case of instance group this defines the list of instances that serve
|
||||
traffic. Member virtual machine instances from each instance group must
|
||||
live in the same zone as the instance group itself. No two 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
|
||||
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 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 }}"'
|
||||
group must be within the same region as the BackendService. Network Endpoint
|
||||
Groups are not supported for INTERNAL load balancing scheme.
|
||||
required: false
|
||||
max_connections:
|
||||
description:
|
||||
|
@ -391,15 +394,23 @@ backends:
|
|||
type: str
|
||||
group:
|
||||
description:
|
||||
- This instance group defines the list of instances that serve traffic. Member
|
||||
virtual machine instances from each instance group must live in the same zone
|
||||
as the instance group itself.
|
||||
- No two backends in a backend service are allowed to use same Instance Group
|
||||
resource.
|
||||
- The fully-qualified URL of an Instance Group or Network Endpoint Group resource.
|
||||
In case of instance group this defines the list of instances that serve traffic.
|
||||
Member virtual machine instances from each instance group must live in the
|
||||
same zone as the instance group itself. No two 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 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
|
||||
type: dict
|
||||
type: str
|
||||
maxConnections:
|
||||
description:
|
||||
- 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']),
|
||||
capacity_scaler=dict(default=1.0, type='str'),
|
||||
description=dict(type='str'),
|
||||
group=dict(type='dict'),
|
||||
group=dict(type='str'),
|
||||
max_connections=dict(type='int'),
|
||||
max_connections_per_instance=dict(type='int'),
|
||||
max_rate=dict(type='int'),
|
||||
|
@ -923,7 +934,7 @@ class BackendServiceBackendsArray(object):
|
|||
u'balancingMode': item.get('balancing_mode'),
|
||||
u'capacityScaler': item.get('capacity_scaler'),
|
||||
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'maxConnectionsPerInstance': item.get('max_connections_per_instance'),
|
||||
u'maxRate': item.get('max_rate'),
|
||||
|
|
|
@ -107,15 +107,23 @@ items:
|
|||
type: str
|
||||
group:
|
||||
description:
|
||||
- This instance group defines the list of instances that serve traffic.
|
||||
Member virtual machine instances from each instance group must live in
|
||||
the same zone as the instance group itself.
|
||||
- No two backends in a backend service are allowed to use same Instance
|
||||
Group resource.
|
||||
- The fully-qualified URL of an Instance Group or Network Endpoint Group
|
||||
resource. In case of instance group this defines the list of instances
|
||||
that serve traffic. Member virtual machine instances from each instance
|
||||
group must live in the same zone as the instance group itself. No two
|
||||
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
|
||||
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
|
||||
type: dict
|
||||
type: str
|
||||
maxConnections:
|
||||
description:
|
||||
- The max number of simultaneous connections for the group. Can be used
|
||||
|
|
|
@ -91,9 +91,8 @@ options:
|
|||
- 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) ."
|
||||
- A BackendService to receive the matched traffic. This is used only for INTERNAL
|
||||
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:
|
||||
|
@ -102,8 +101,7 @@ options:
|
|||
required: false
|
||||
ip_version:
|
||||
description:
|
||||
- The IP Version that will be used by this forwarding rule. Valid options are
|
||||
IPV4 or IPV6. This can only be specified for a global forwarding rule.
|
||||
- ipVersion is not a valid field for regional forwarding rules.
|
||||
required: false
|
||||
choices:
|
||||
- IPV4
|
||||
|
@ -133,7 +131,7 @@ options:
|
|||
- 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 only used for INTERNAL load balancing.
|
||||
- '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
|
||||
of your resource''s selfLink Alternatively, you can add `register: name-of-resource`
|
||||
|
@ -164,12 +162,10 @@ options:
|
|||
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.
|
||||
- The subnetwork that the load balanced IP should belong to for this Forwarding
|
||||
Rule. This field is only used for INTERNAL load balancing.
|
||||
- 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`
|
||||
|
@ -178,12 +174,10 @@ options:
|
|||
required: false
|
||||
target:
|
||||
description:
|
||||
- This field is only used for EXTERNAL load balancing.
|
||||
- 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
|
||||
forwarding rule. For global forwarding rules, this target must be a global 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.
|
||||
- This target must live in the same region as the forwarding rule.
|
||||
- The forwarded traffic must be of a type appropriate to the target object.
|
||||
- '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
|
||||
of your resource''s selfLink Alternatively, you can add `register: name-of-resource`
|
||||
|
@ -193,9 +187,10 @@ options:
|
|||
version_added: 2.7
|
||||
all_ports:
|
||||
description:
|
||||
- When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit `port`/`port_range`
|
||||
and specify this field as `true` to allow packets addressed to any ports to
|
||||
be forwarded to the backends configured with this forwarding rule.
|
||||
- For internal TCP/UDP load balancing (i.e. load balancing scheme is INTERNAL
|
||||
and protocol is TCP/UDP), set this to true to allow packets addressed to any
|
||||
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
|
||||
type: bool
|
||||
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
|
||||
letter, and all following characters must be a dash, lowercase 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.
|
||||
required: false
|
||||
version_added: 2.8
|
||||
region:
|
||||
|
@ -316,15 +311,13 @@ IPProtocol:
|
|||
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) ."
|
||||
- A BackendService to receive the matched traffic. This is used only for INTERNAL
|
||||
load balancing.
|
||||
returned: success
|
||||
type: dict
|
||||
ipVersion:
|
||||
description:
|
||||
- The IP Version that will be used by this forwarding rule. Valid options are IPV4
|
||||
or IPV6. This can only be specified for a global forwarding rule.
|
||||
- ipVersion is not a valid field for regional forwarding rules.
|
||||
returned: success
|
||||
type: str
|
||||
loadBalancingScheme:
|
||||
|
@ -351,7 +344,7 @@ network:
|
|||
- 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 only used for INTERNAL load balancing.
|
||||
returned: success
|
||||
type: dict
|
||||
portRange:
|
||||
|
@ -379,29 +372,26 @@ ports:
|
|||
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.
|
||||
- The subnetwork that the load balanced IP should belong to for this Forwarding
|
||||
Rule. This field is only used for INTERNAL load balancing.
|
||||
- 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
|
||||
target:
|
||||
description:
|
||||
- This field is only used for EXTERNAL load balancing.
|
||||
- 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
|
||||
forwarding rule. For global forwarding rules, this target must be a global 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.
|
||||
- This target must live in the same region as the forwarding rule.
|
||||
- The forwarded traffic must be of a type appropriate to the target object.
|
||||
returned: success
|
||||
type: dict
|
||||
allPorts:
|
||||
description:
|
||||
- When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit `port`/`port_range`
|
||||
and specify this field as `true` to allow packets addressed to any ports to be
|
||||
forwarded to the backends configured with this forwarding rule.
|
||||
- For internal TCP/UDP load balancing (i.e. load balancing scheme is INTERNAL and
|
||||
protocol is TCP/UDP), set this to true to allow packets addressed to any 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
|
||||
type: bool
|
||||
networkTier:
|
||||
|
@ -420,13 +410,13 @@ serviceLabel:
|
|||
`[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,
|
||||
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
|
||||
type: str
|
||||
serviceName:
|
||||
description:
|
||||
- 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
|
||||
type: str
|
||||
region:
|
||||
|
|
|
@ -119,15 +119,13 @@ items:
|
|||
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) ."
|
||||
- A BackendService to receive the matched traffic. This is used only for INTERNAL
|
||||
load balancing.
|
||||
returned: success
|
||||
type: dict
|
||||
ipVersion:
|
||||
description:
|
||||
- The IP Version that will be used by this forwarding rule. Valid options are
|
||||
IPV4 or IPV6. This can only be specified for a global forwarding rule.
|
||||
- ipVersion is not a valid field for regional forwarding rules.
|
||||
returned: success
|
||||
type: str
|
||||
loadBalancingScheme:
|
||||
|
@ -154,7 +152,7 @@ items:
|
|||
- 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 only used for INTERNAL load balancing.
|
||||
returned: success
|
||||
type: dict
|
||||
portRange:
|
||||
|
@ -184,29 +182,26 @@ items:
|
|||
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.
|
||||
- The subnetwork that the load balanced IP should belong to for this Forwarding
|
||||
Rule. This field is only used for INTERNAL load balancing.
|
||||
- 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
|
||||
target:
|
||||
description:
|
||||
- This field is only used for EXTERNAL load balancing.
|
||||
- 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 forwarding rule. For global forwarding rules, this target must be a global
|
||||
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.
|
||||
- This target must live in the same region as the forwarding rule.
|
||||
- The forwarded traffic must be of a type appropriate to the target object.
|
||||
returned: success
|
||||
type: dict
|
||||
allPorts:
|
||||
description:
|
||||
- When the load balancing scheme is INTERNAL and protocol is TCP/UDP, omit `port`/`port_range`
|
||||
and specify this field as `true` to allow packets addressed to any ports to
|
||||
be forwarded to the backends configured with this forwarding rule.
|
||||
- For internal TCP/UDP load balancing (i.e. load balancing scheme is INTERNAL
|
||||
and protocol is TCP/UDP), set this to true to allow packets addressed to any
|
||||
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
|
||||
type: bool
|
||||
networkTier:
|
||||
|
@ -225,13 +220,13 @@ items:
|
|||
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
|
||||
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
|
||||
type: str
|
||||
serviceName:
|
||||
description:
|
||||
- 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
|
||||
type: str
|
||||
region:
|
||||
|
|
|
@ -217,7 +217,8 @@ def create(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):
|
||||
|
|
|
@ -81,8 +81,8 @@ options:
|
|||
ip_protocol:
|
||||
description:
|
||||
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP,
|
||||
AH, SCTP or ICMP.
|
||||
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid.
|
||||
AH, SCTP or ICMP. When the load balancing scheme is INTERNAL_SELF_MANAGED, only
|
||||
TCP is valid.
|
||||
required: false
|
||||
choices:
|
||||
- TCP
|
||||
|
@ -91,35 +91,24 @@ options:
|
|||
- AH
|
||||
- SCTP
|
||||
- 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:
|
||||
description:
|
||||
- The IP Version that will be used by this forwarding rule. Valid options are
|
||||
IPV4 or IPV6. This can only be specified for a global forwarding rule.
|
||||
- The IP Version that will be used by this global forwarding rule.
|
||||
- Valid options are IPV4 or IPV6.
|
||||
required: false
|
||||
choices:
|
||||
- IPV4
|
||||
- IPV6
|
||||
load_balancing_scheme:
|
||||
description:
|
||||
- 'This signifies what the ForwardingRule will be used for and can only take the
|
||||
following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will
|
||||
be used for Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL
|
||||
means that this will be used for External Load Balancing (HTTP(S) LB, External
|
||||
TCP/UDP LB, SSL Proxy) .'
|
||||
- This signifies what the GlobalForwardingRule will be used for.
|
||||
- 'The value of INTERNAL_SELF_MANAGED means that this will be used for Internal
|
||||
Global HTTP(S) LB. The value of EXTERNAL means that this will be used for External
|
||||
Global Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy) NOTE: Currently
|
||||
global forwarding rules cannot be used for INTERNAL load balancing.'
|
||||
required: false
|
||||
choices:
|
||||
- INTERNAL
|
||||
- INTERNAL_SELF_MANAGED
|
||||
- EXTERNAL
|
||||
name:
|
||||
description:
|
||||
|
@ -132,10 +121,10 @@ options:
|
|||
required: true
|
||||
network:
|
||||
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.
|
||||
- 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
|
||||
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`
|
||||
|
@ -156,34 +145,11 @@ options:
|
|||
43, 110, 143, 195, 443, 465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway:
|
||||
500, 4500 .'
|
||||
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:
|
||||
description:
|
||||
- This target must be a global load balancing resource. The forwarded traffic
|
||||
must be of a type appropriate to the target object.
|
||||
- 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .'
|
||||
required: false
|
||||
- The URL of the target resource to receive the matched traffic.
|
||||
- The forwarded traffic must be of a type appropriate to the target object.
|
||||
required: true
|
||||
extends_documentation_fragment: gcp
|
||||
'''
|
||||
|
||||
|
@ -310,30 +276,23 @@ IPAddress:
|
|||
IPProtocol:
|
||||
description:
|
||||
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP, AH,
|
||||
SCTP or ICMP.
|
||||
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid.
|
||||
SCTP or ICMP. When the load balancing scheme is INTERNAL_SELF_MANAGED, only TCP
|
||||
is valid.
|
||||
returned: success
|
||||
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:
|
||||
description:
|
||||
- The IP Version that will be used by this forwarding rule. Valid options are IPV4
|
||||
or IPV6. This can only be specified for a global forwarding rule.
|
||||
- The IP Version that will be used by this global forwarding rule.
|
||||
- Valid options are IPV4 or IPV6.
|
||||
returned: success
|
||||
type: str
|
||||
loadBalancingScheme:
|
||||
description:
|
||||
- 'This signifies what the ForwardingRule will be used for and can only take the
|
||||
following values: INTERNAL, EXTERNAL The value of INTERNAL means that this will
|
||||
be used for Internal Network Load Balancing (TCP, UDP). The value of EXTERNAL
|
||||
means that this will be used for External Load Balancing (HTTP(S) LB, External
|
||||
TCP/UDP LB, SSL Proxy) .'
|
||||
- This signifies what the GlobalForwardingRule will be used for.
|
||||
- 'The value of INTERNAL_SELF_MANAGED means that this will be used for Internal
|
||||
Global HTTP(S) LB. The value of EXTERNAL means that this will be used for External
|
||||
Global Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy) NOTE: Currently
|
||||
global forwarding rules cannot be used for INTERNAL load balancing.'
|
||||
returned: success
|
||||
type: str
|
||||
name:
|
||||
|
@ -348,10 +307,10 @@ name:
|
|||
type: str
|
||||
network:
|
||||
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.
|
||||
- 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
|
||||
type: dict
|
||||
portRange:
|
||||
|
@ -368,36 +327,10 @@ portRange:
|
|||
465, 587, 700, 993, 995, 1883, 5222 * TargetVpnGateway: 500, 4500 .'
|
||||
returned: success
|
||||
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:
|
||||
description:
|
||||
- This target must be a global load balancing resource. The forwarded traffic must
|
||||
be of a type appropriate to the target object.
|
||||
- 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .'
|
||||
- The URL of the target resource to receive the matched traffic.
|
||||
- The forwarded traffic must be of a type appropriate to the target object.
|
||||
returned: success
|
||||
type: str
|
||||
'''
|
||||
|
@ -424,15 +357,12 @@ 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(type='dict'),
|
||||
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'),
|
||||
network=dict(type='dict'),
|
||||
port_range=dict(type='str'),
|
||||
ports=dict(type='list', elements='str'),
|
||||
subnetwork=dict(type='dict'),
|
||||
target=dict(type='str'),
|
||||
target=dict(required=True, type='str'),
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -448,7 +378,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:
|
||||
|
@ -472,9 +402,22 @@ 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))
|
||||
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')
|
||||
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):
|
||||
|
@ -488,14 +431,11 @@ def resource_to_request(module):
|
|||
u'description': module.params.get('description'),
|
||||
u'IPAddress': module.params.get('ip_address'),
|
||||
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'loadBalancingScheme': module.params.get('load_balancing_scheme'),
|
||||
u'name': module.params.get('name'),
|
||||
u'network': replace_resource_dict(module.params.get(u'network', {}), 'selfLink'),
|
||||
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'),
|
||||
}
|
||||
return_vals = {}
|
||||
|
@ -567,15 +507,11 @@ def response_to_hash(module, response):
|
|||
u'id': response.get(u'id'),
|
||||
u'IPAddress': response.get(u'IPAddress'),
|
||||
u'IPProtocol': response.get(u'IPProtocol'),
|
||||
u'backendService': response.get(u'backendService'),
|
||||
u'ipVersion': response.get(u'ipVersion'),
|
||||
u'loadBalancingScheme': response.get(u'loadBalancingScheme'),
|
||||
u'name': response.get(u'name'),
|
||||
u'network': response.get(u'network'),
|
||||
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'),
|
||||
}
|
||||
|
||||
|
|
|
@ -107,30 +107,23 @@ items:
|
|||
IPProtocol:
|
||||
description:
|
||||
- The IP protocol to which this rule applies. Valid options are TCP, UDP, ESP,
|
||||
AH, SCTP or ICMP.
|
||||
- When the load balancing scheme is INTERNAL, only TCP and UDP are valid.
|
||||
AH, SCTP or ICMP. When the load balancing scheme is INTERNAL_SELF_MANAGED,
|
||||
only TCP is valid.
|
||||
returned: success
|
||||
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:
|
||||
description:
|
||||
- The IP Version that will be used by this forwarding rule. Valid options are
|
||||
IPV4 or IPV6. This can only be specified for a global forwarding rule.
|
||||
- The IP Version that will be used by this global forwarding rule.
|
||||
- Valid options are IPV4 or IPV6.
|
||||
returned: success
|
||||
type: str
|
||||
loadBalancingScheme:
|
||||
description:
|
||||
- 'This signifies what the ForwardingRule will be used for and can only take
|
||||
the following values: INTERNAL, EXTERNAL The value of INTERNAL means that
|
||||
this will be used for Internal Network Load Balancing (TCP, UDP). The value
|
||||
of EXTERNAL means that this will be used for External Load Balancing (HTTP(S)
|
||||
LB, External TCP/UDP LB, SSL Proxy) .'
|
||||
- This signifies what the GlobalForwardingRule will be used for.
|
||||
- 'The value of INTERNAL_SELF_MANAGED means that this will be used for Internal
|
||||
Global HTTP(S) LB. The value of EXTERNAL means that this will be used for
|
||||
External Global Load Balancing (HTTP(S) LB, External TCP/UDP LB, SSL Proxy)
|
||||
NOTE: Currently global forwarding rules cannot be used for INTERNAL load balancing.'
|
||||
returned: success
|
||||
type: str
|
||||
name:
|
||||
|
@ -145,10 +138,10 @@ items:
|
|||
type: str
|
||||
network:
|
||||
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.
|
||||
- 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
|
||||
type: dict
|
||||
portRange:
|
||||
|
@ -166,37 +159,10 @@ items:
|
|||
500, 4500 .'
|
||||
returned: success
|
||||
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:
|
||||
description:
|
||||
- This target must be a global load balancing resource. The forwarded traffic
|
||||
must be of a type appropriate to the target object.
|
||||
- 'Valid types: HTTP_PROXY, HTTPS_PROXY, SSL_PROXY, TCP_PROXY .'
|
||||
- The URL of the target resource to receive the matched traffic.
|
||||
- The forwarded traffic must be of a type appropriate to the target object.
|
||||
returned: success
|
||||
type: str
|
||||
'''
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
---
|
||||
# defaults file
|
||||
resource_name: '{{resource_prefix}}'
|
||||
resource_name: "{{ resource_prefix }}"
|
||||
|
|
Loading…
Reference in a new issue