ansible-collections / ansible-collections/google.cloud
`gcp_compute_route` requires `dest_range` with `state: absent`
- Dominant language
- Python
- Stars
- 105
- Forks
- 144
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 4
Description
##### SUMMARY
When setting `state: absent` in `gcp_compute_route`, the module complains that `dest_range` is not set. The same happens with `gcp_compute_subnetwork` and the `ip_cidr_range` parameter.
##### ISSUE TYPE
- Bug Report
##### COMPONENT NAME
gcp_compute_route
##### COLLECTION VERSION
```paste below
google.cloud 1.1.2
```
Latest master actually.
Original discussion [here](https://github.com/ansible/ansible/issues/56325).
Possible solution:
Instead of:
https://github.com/ansible-collections/google.cloud/blob/226ec3dd3fb2eb3b2131014816240298126400fc/plugins/modules/gcp_compute_route.py#L344-L359
do:
```python
module = GcpModule(
argument_spec=dict(
state=dict(default='present', choices=['present', 'absent'], type='str'),
dest_range=dict(type='str'), # CHANGED
description=dict(type='str'),
name=dict(required=True, type='str'),
network=dict(required=True, type='dict'),
priority=dict(type='int'),
tags=dict(type='list', elements='str'),
next_hop_gateway=dict(type='str'),
next_hop_instance=dict(type='dict'),
next_hop_ip=dict(type='str'),
next_hop_vpn_tunnel=dict(type='dict'),
next_hop_ilb=dict(type='dict'),
),
# CHANGED
required_if=[
(`state`, `present`, (`dest_range`)),
]
)
```
Contributor guide
Research direction
Start in plugins/modules/gcp_compute_route.py at the argument specification around the referenced lines, and compare the state handling with the issue's proposed requirement. Check the corresponding gcp_compute_subnetwork parameter behavior as well. Done means absent state no longer requires dest_range, while present state still validates it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- gcp, python
- Domain
- cloud, devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100