Terraform New Relic Workload 资源的查询格式是什么
What is the query format for Terraform New Relic Workload resource
Terraform New Relic Workload 资源的查询格式是什么?我的 main.tf
文件中指定了以下资源,我希望能够获取所有具有特定标签的实体。
...
resource "newrelic_workload" "prod-app" {
name = "Prod App"
account_id = <account id>
entity_search_query {
query = "label.STAGE = prod"
}
}
但是,似乎抛出了这个错误:
Error: A downstream error occurred., [{"extensions":{},"message":"Search query \u003clabel.STAGE = 'prod'\u003e is invalid, response message is \u003cProvided filter: label.STAGE = 'prod' is not a valid NRQL query (You can't use field: label.STAGE, that is not defined in schema.)\u003e"}]
除了需要是有效的 NRQL 查询之外,文档中似乎没有太多信息。该示例似乎使用 "name like 'Example application'"
https://registry.terraform.io/providers/newrelic/newrelic/latest/docs/resources/workload
好的,我明白了。事实证明,我只是指的是一个不存在的密钥。
应该是 tags.<tag key>
所以 tags.label.STAGE
.
当我查看幕后的 API 时,我发现了我的错误。它使用 NerdGraph API and the Query entities 部分描述如何构建查询。
Terraform New Relic Workload 资源的查询格式是什么?我的 main.tf
文件中指定了以下资源,我希望能够获取所有具有特定标签的实体。
...
resource "newrelic_workload" "prod-app" {
name = "Prod App"
account_id = <account id>
entity_search_query {
query = "label.STAGE = prod"
}
}
但是,似乎抛出了这个错误:
Error: A downstream error occurred., [{"extensions":{},"message":"Search query \u003clabel.STAGE = 'prod'\u003e is invalid, response message is \u003cProvided filter: label.STAGE = 'prod' is not a valid NRQL query (You can't use field: label.STAGE, that is not defined in schema.)\u003e"}]
除了需要是有效的 NRQL 查询之外,文档中似乎没有太多信息。该示例似乎使用 "name like 'Example application'"
https://registry.terraform.io/providers/newrelic/newrelic/latest/docs/resources/workload
好的,我明白了。事实证明,我只是指的是一个不存在的密钥。
应该是 tags.<tag key>
所以 tags.label.STAGE
.
当我查看幕后的 API 时,我发现了我的错误。它使用 NerdGraph API and the Query entities 部分描述如何构建查询。