logdna / terraform-provider-logdna

Terraform provider to simplify creation of views, preset alerts and other resources in LogDNA!
https://registry.terraform.io/providers/logdna/logdna/latest
MIT License
11 stars 12 forks source link

logdna_view apply failure with "At least one of terminal, immediate must be true" #105

Closed mriedem closed 3 months ago

mriedem commented 3 months ago

I had a logdna_view resource defined with this block:

  pagerduty_channel {
    key          = var.pagerduty_integration_key
    triggerlimit = 1
  }

And it failed with:

Error: POST https://api.us-east.logging.cloud.ibm.com/v1/config/view, status 400 NOT OK! {"details":[{"message":"At least one of terminal, immediate must be true","key":"channels[0].immediate"}],"error":"At least one of terminal, immediate must be true","code":"BadRequest","status":"error"}

According to the docs both immediate and terminal are optional, and immediate defaults to "false" while terminal defaults to "true", so isn't the condition already satisfied given the defaults?

If this isn't an API issue, then I suggest the docs be updated to explain that at least one of terminal or immediate must be specified and must be true.

jakedipity commented 3 months ago

The API response is correct, either one or both of them need to be true. If both were false that would mean an alert should never be sent.

The terraform isn't quite incorrect because independently they are optional, but I agree the text should be updated to specify the relationship they have with each other.