ansible-collections / ansible-collections/google.cloud
Updating Regional URL Maps with gcp_compute_region_url_map fails due to fingerprint missing from API call
- Dominant language
- Python
- Stars
- 105
- Forks
- 144
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 4
Description
##### SUMMARY
When attempting to update a GCP Regional URL Map with `google.cloud.gcp_compute_region_url_map` it fails with error from API stating that required fingerprint is missing.
**I've forked the repo and adding in a ~2 line change to add the fingerprint to the request and verified it does work. I'm happy to open a PR for this if it will be accepted.**
##### ISSUE TYPE
- Bug Report
##### COMPONENT NAME
`google.cloud.gcp_compute_region_url_map`
##### ANSIBLE VERSION
```paste below
ansible [core 2.14.5]
config file = /Users/ferris/dev/my-repo/ansible/ansible.cfg
configured module search path = ['/Users/ferris/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/ferris/.local/share/virtualenvs/ansible-u48fEg-V/lib/python3.9/site-packages/ansible
ansible collection location = /Users/ferris/.ansible/collections:/usr/share/ansible/collections
executable location = /Users/ferris/.local/share/virtualenvs/ansible-u48fEg-V/bin/ansible
python version = 3.9.16 (main, Dec 7 2022, 10:02:13) [Clang 14.0.0 (clang-1400.0.29.202)] (/Users/ferris/.local/share/virtualenvs/ansible-u48fEg-V/bin/python)
jinja version = 3.1.2
libyaml = True
```
##### COLLECTION VERSION
```
Collection Version
-------------------- -------
google.cloud 1.1.3
```
##### CONFIGURATION
```paste below
CONFIG_FILE() = /Users/ferris/dev/my-repo/ansible/ansible.cfg
INVENTORY_ENABLED(/Users/ferris/dev/my-repo/ansible/ansible.cfg) = ['kubernetes.core.k8s']
```
##### OS / ENVIRONMENT
MacOS 12.6 on M1 CPU
##### STEPS TO REPRODUCE
Manually create a GCP Regional Load Balancer, then have Ansible attempt to update it.
```yaml
- name: Configure GCP regional Load Balancer URL Map for EOS
register: gcp_lb_update
google.cloud.gcp_compute_region_url_map:
state: present
auth_kind: "application"
project: "{{gcp_project_id}}"
region: "{{gcp_region}}"
name: "{{gcp_url_map_name}}"
default_service: { selfLink: "https://www.googleapis.com/compute/v1/projects/{{gcp_project_id}}/regions/{{gcp_region}}/backendServices/{{my_service_id}}" }
host_rules:
- description: Matches all hosts
path_matcher: default
hosts:
- '*'
path_matchers:
- default_service: { selfLink: "https://www.googleapis.com/compute/v1/projects/{{gcp_project_id}}/regions/{{gcp_region}}/backendServices/{{my_service_id}}" }
name: default
```
##### EXPECTED RESULTS
```
TASK [Configure GCP regional Load Balancer URL Map for EOS] *******************
changed: [localhost]
```
##### ACTUAL RESULTS
The GCP API fails the update request with a descriptive error stating the fingerprint is missing.
```
TASK [Configure GCP regional Load Balancer URL Map for EOS] *******************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "GCP returned error: {
'error': {'code': 400, 'message': \"Required field 'resource.fingerprint' not
specified\", 'errors': [{'message': \"Required field 'resource.fingerprint' not
specified\", 'domain': 'global', 'reason': 'required'}]}}", "request": {"body":
"{\"kind\": \"compute#urlMap\", \"defaultService\":
\"https://www.googleapis.com/compute/v1/projects/my-project/regions/us-west4/backendServices/my-service\",
\"hostRules\": [{\"description\": \"Matches all hosts\", \"hosts\": [\"*\"],
\"pathMatcher\": \"default\"}], \"name\": \"s9-denver-eos-http-us-west4\",
\"pathMatchers\": [{\"defaultService\":
\"https://www.googleapis.com/compute/v1/projects/my-project/regions/us-west4/backendServices/my-service\",
\"name\": \"default\"}]}", "method": "PUT", "url":
"https://compute.googleapis.com/compute/v1/projects/my-project/regions/us-west4/urlMaps/my-url-map"}}
```
Contributor guide
Research direction
Start at the google.cloud.gcp_compute_region_url_map module entry point and inspect the update request described in the issue. Reproduce the regional URL map update, ensure the existing resource fingerprint is included in the request, and confirm the GCP API accepts the update without the missing-fingerprint error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, python
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100