Allow target to accept other resource types (#134)

Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: Ty Larrabee <tysen@google.com>
This commit is contained in:
The Magician 2020-01-13 11:09:11 -08:00 committed by Ty Larrabee
parent dd1aefed8d
commit 9d30baeec9
4 changed files with 20 additions and 21 deletions

View file

@ -172,17 +172,11 @@ options:
type: dict
target:
description:
- This field is only used for EXTERNAL load balancing.
- A reference to a TargetPool resource to receive the matched traffic.
- This target must live in the same region as the forwarding rule.
- The URL of the target resource to receive the matched traffic.
- The 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`
to a gcp_compute_target_pool task and then set this target field to "{{ name-of-resource
}}"'
required: false
type: dict
type: str
version_added: '2.7'
all_ports:
description:
@ -423,12 +417,11 @@ subnetwork:
type: dict
target:
description:
- This field is only used for EXTERNAL load balancing.
- A reference to a TargetPool resource to receive the matched traffic.
- This target must live in the same region as the forwarding rule.
- The URL of the target resource to receive the matched traffic.
- The 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
type: str
allPorts:
description:
- For internal TCP/UDP load balancing (i.e. load balancing scheme is INTERNAL and
@ -499,7 +492,7 @@ def main():
port_range=dict(type='str'),
ports=dict(type='list', elements='str'),
subnetwork=dict(type='dict'),
target=dict(type='dict'),
target=dict(type='str'),
all_ports=dict(type='bool'),
network_tier=dict(type='str'),
service_label=dict(type='str'),
@ -557,7 +550,7 @@ def target_update(module, request, response):
auth = GcpSession(module, 'compute')
auth.post(
''.join(["https://www.googleapis.com/compute/v1/", "projects/{project}/regions/{region}/forwardingRules/{name}/setTarget"]).format(**module.params),
{u'target': replace_resource_dict(module.params.get(u'target', {}), 'selfLink')},
{u'target': module.params.get('target')},
)
@ -579,7 +572,7 @@ def resource_to_request(module):
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': replace_resource_dict(module.params.get(u'target', {}), 'selfLink'),
u'target': module.params.get('target'),
u'allPorts': module.params.get('all_ports'),
u'networkTier': module.params.get('network_tier'),
u'serviceLabel': module.params.get('service_label'),

View file

@ -235,12 +235,11 @@ resources:
type: dict
target:
description:
- This field is only used for EXTERNAL load balancing.
- A reference to a TargetPool resource to receive the matched traffic.
- This target must live in the same region as the forwarding rule.
- The URL of the target resource to receive the matched traffic.
- The 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
type: str
allPorts:
description:
- For internal TCP/UDP load balancing (i.e. load balancing scheme is INTERNAL

View file

@ -66,9 +66,12 @@ options:
description:
- A multiplier applied to the group's maximum servicing capacity (based on
UTILIZATION, RATE or CONNECTION).
- Default value is 1, which means the group will serve up to 100% of its configured
capacity (depending on balancingMode).
- A setting of 0 means the group is completely drained, offering 0% of its
available Capacity. Valid range is [0.0,1.0].
required: false
default: '1.0'
type: str
description:
description:
@ -318,6 +321,8 @@ backends:
description:
- A multiplier applied to the group's maximum servicing capacity (based on UTILIZATION,
RATE or CONNECTION).
- Default value is 1, which means the group will serve up to 100% of its configured
capacity (depending on balancingMode).
- A setting of 0 means the group is completely drained, offering 0% of its available
Capacity. Valid range is [0.0,1.0].
returned: success
@ -514,7 +519,7 @@ def main():
elements='dict',
options=dict(
balancing_mode=dict(default='CONNECTION', type='str'),
capacity_scaler=dict(type='str'),
capacity_scaler=dict(default=1.0, type='str'),
description=dict(type='str'),
group=dict(required=True, type='str'),
max_connections=dict(type='int'),

View file

@ -133,6 +133,8 @@ resources:
description:
- A multiplier applied to the group's maximum servicing capacity (based
on UTILIZATION, RATE or CONNECTION).
- Default value is 1, which means the group will serve up to 100% of its
configured capacity (depending on balancingMode).
- A setting of 0 means the group is completely drained, offering 0% of its
available Capacity. Valid range is [0.0,1.0].
returned: success