linode / ansible_linode

Linode Ansible Collection
GNU General Public License v3.0
57 stars 23 forks source link

[Bug]: region_list does not with with an ID filter as in the docs #557

Open enygren opened 1 month ago

enygren commented 1 month ago

Ansible Version

ansible [core 2.13.10]

Ansible Configuration

No response

Effected Components

region_list

Expected Behavior

Should have filtered to return a specific region by id

Actual Behavior

Errors that id is not a valid filter

Steps to Reproduce

Sample task:

    - name: Get region information
      linode.cloud.region_list:
        api_token: "{{ linode.api_token }}"
        filters:
          - name: id
            values: us-east
      register: region_result

fails with:

fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "api_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "api_url": "https://api.linode.com/",
            "api_version": "v4",
            "ca_path": null,
            "count": null,
            "filters": [
                {
                    "name": "id",
                    "values": [
                        "us-east"
                    ]
                }
            ],
            "label": null,
            "order": "asc",
            "order_by": null,
            "state": null,
            "tags": null,
            "ua_prefix": null
        }
    },
    "msg": "Error from Linode API: [400] Cannot filter on id"
}

Although this example comes directly from:

https://github.com/linode/ansible_linode/blob/dev/docs/modules/region_list.md

enygren commented 1 month ago

It may be that adding in a way to get a specific region by id would be preferable for this use-case? (eg, for https://techdocs.akamai.com/linode-api/reference/get-region)

Need is to be able to get attributes for a particular region (eg, site_type)

zliang-akamai commented 1 month ago

HI @enygren, thanks for the bug report! We will be looking into it.