ansible-collections / ansible-collections/google.cloud
gcp_dns_resource_record_set fails to detect changes when removing IPs from DNS A records
- Dominant language
- Python
- Stars
- 105
- Forks
- 144
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 4
Description
##### SUMMARY
The `gcp_dns_resource_record_set` module doesn't properly detect when you're trying to remove IPs from a DNS record. If a record currently has IPs [A, B] and you want to change it to just [B], the module thinks nothing needs to change because B exists in the current list. It only checks if your desired IPs are present, not if extra IPs should be removed.
I think the bug is in `_compare_lists()` in `gcp_utils.py` - it only does a one-way check to see if request items exist in the response, but doesn't check the reverse.
##### ISSUE TYPE
- Bug Report
##### COMPONENT NAME
`gcp_dns_resource_record_set`
##### ANSIBLE VERSION
```
ansible [core 2.17.9]
```
##### COLLECTION VERSION
```
google.cloud (1.10.2)
```
##### CONFIGURATION
##### OS / ENVIRONMENT
Running on Debian version 12 (bookworm) Linux
##### STEPS TO REPRODUCE
1. Start with a DNS A record that has 2 IPs:
```
test.example.com. A 30
- 192.168.1.10
- 192.168.1.20
```
2. Try to update it to just one IP with this playbook:
```yaml
- name: Update DNS to single IP
google.cloud.gcp_dns_resource_record_set:
project: my-gcp-project
managed_zone:
name: "my-dns-zone"
dnsName: "example.com."
type: A
name: "test.example.com."
target:
- "192.168.1.20"
ttl: 30
auth_kind: application
state: present
```
##### EXPECTED RESULTS
Should update the record and remove 192.168.1.10, leaving only 192.168.1.20.
##### ACTUAL RESULTS
Module says everything's fine:
```
ok: [localhost]
```
But the DNS still has both IPs. Nothing changed.
Contributor guide
Research direction
Start in gcp_utils.py at _compare_lists() and reproduce the DNS A-record scenario from the issue's playbook. Verify that extra current IPs are detected, then confirm the module updates the record so only 192.168.1.20 remains.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ansible, gcp, python
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100