ansible-collections / ansible-collections/google.cloud

Misleading documentation about using RegEx in gcp_compute_forwarding_rule_info filter

Open Beginner friendly
#593 1 comment 0 reactions 0 assignees View on GitHub
stale
Dominant language
Python
Stars
105
Forks
144
Avg merge
5d 10h
Merged PRs (30d)
4

Description

Hi,

My goal was to filter forwarding rules using RegEx. I got familiar with:
https://docs.ansible.com/ansible/latest/collections/google/cloud/gcp_compute_forwarding_rule_info_module.html#parameter-filters
It directed me to https://cloud.google.com/sdk/gcloud/reference/topic/filters

I tried to use a RegEx based filter like that (using ~ operator as it was indicated in https://cloud.google.com/sdk/gcloud/reference/topic/filters):

```
gcp_compute_forwarding_rule_info:
filters:
- "name ~ 'test.+'"
```

However, GCP returned an error. At the same time I was able to use mentioned filter with gcloud. After some digging I realized that gcp_compute_forwarding_rule_info module talks to https://cloud.google.com/compute/docs/reference/rest/v1/forwardingRules/list service. In order to use RegEx I had to change my declaration to:

```
gcp_compute_forwarding_rule_info:
filters:
- "name eq test.+" # Google RE2 syntax
```
Please correct the documentation because I had to spend a couple of hours to find a way to use RegEx. Please verify if this problem is gcp_compute_forwarding_rule_info related only.

Contributor guide

Open the contributing guide

Research direction

Start with the gcp_compute_forwarding_rule_info documentation for the filters parameter, then compare its linked gcloud filter reference with the Compute Engine forwardingRules.list reference. Verify whether the documented regular-expression syntax applies only to this module or to other related modules, and update the documentation to describe the working syntax and distinction.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.