Skip to content

data datadog_monitors: allow queries that do not return value(s)Β #2782

Open
@amolari

Description

@amolari

What resources or data sources are affected?

data datadog_monitors

Feature Request

Please support a queries that do not return any monitor. The returned attribute "monitors" should then be simply an empty list.
Example (as it would be seen in the TF state):

    {
      "module": "module.mymodule_datadog_events",
      "mode": "data",
      "type": "datadog_monitors",
      "name": "mydataresourcename",
      "provider": "provider[\"registry.terraform.io/datadog/datadog\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "id": "||team:teamA,service:serviceA,deploymentname:somevalue",
            "monitor_tags_filter": [
              "team:teamA",
              "service:serviceA",
              "deploymentname:somevalue"
            ],
            "monitors": [],
            "name_filter": null,
            "tags_filter": null
          },
          "sensitive_attributes": []
        }
      ]
    }

Using the provider v4.5.0, if the query doesn't return any list of monitor, it fails with such error:

Error: your query returned no result, please try a less specific search criteria
with module.mymodule_datadog_events.data.datadog_monitors.mydataresourcename
on .terraform/modules/mymodule_datadog_events/main.tf line 42, in data "datadog_monitors" "mydataresourcename":
data "datadog_monitors" "mydataresourcename" {

References

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions