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

Adds support for nesting bodytemplates and improves tests to better cover error-handling #7

Closed dm36 closed 3 years ago

dm36 commented 3 years ago

Updates resource_view code to support nesting body templates, updates docs to reflect these changes and adds an example config file.

Additionally fixes the badge on the README to reflect current coverage, updates the go.mod to point to Github and improves tests to better cover error-handling.

Ref: LOG-7689, LOG-7779 Semver: Patch

michaelshi-logdna commented 3 years ago

Update: this was fixed

One bug that I noticed while testing is that the bodytemplate would not fail with invalid JSON being provided to it. This is an example resource that should fail:

resource "logdna_view" "my_view" {
  name     = "webhook"
  query    = "test"
  webhook_channel {
    bodytemplate = "{\"test\": }"
    triggerlimit    = 1
    url             = "https://webhook.site/81e60658-169f-43ce-9bc2-705468fefdfc"
  }
}

On the config API side it seems like it's not really possible to provide malformed bodytemplates since any invalid JSON would create an invalid overall payload so my hunch is that there's probably something silently failing on the TF side.

ghost commented 3 years ago

One bug that I noticed while testing is that the bodytemplate would not fail with invalid JSON being provided to it. This is an example resource that should fail:

resource "logdna_view" "my_view" {
  name     = "webhook"
  query    = "test"
  webhook_channel {
    bodytemplate = "{\"test\": }"
    triggerlimit    = 1
    url             = "https://webhook.site/81e60658-169f-43ce-9bc2-705468fefdfc"
  }
}

On the config API side it seems like it's not really possible to provide malformed bodytemplates since any invalid JSON would create an invalid overall payload so my hunch is that there's probably something silently failing on the TF side.

@dm36 I'm curious about this. Is this current?

michaelshi-logdna commented 3 years ago

Sorry this was fixed as of last night and no longer current.

On Wed, Oct 28, 2020 at 3:53 PM Yash Shah notifications@github.com wrote:

One bug that I noticed while testing is that the bodytemplate would not fail with invalid JSON being provided to it. This is an example resource that should fail:

resource "logdna_view" "my_view" { name = "webhook" query = "test" webhook_channel { bodytemplate = "{\"test\": }" triggerlimit = 1 url = "https://webhook.site/81e60658-169f-43ce-9bc2-705468fefdfc" } }

On the config API side it seems like it's not really possible to provide malformed bodytemplates since any invalid JSON would create an invalid overall payload so my hunch is that there's probably something silently failing on the TF side.

@dm36 https://github.com/dm36 I'm curious about this. Is this current?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/logdna/terraform-provider-logdna/pull/7#issuecomment-718253909, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN4JWX3O36EH7WTES6NJMPDSNCOGHANCNFSM4TAJRGXA .

--

[image: LogDNA] https://logdna.com/ Michael Shi · Associate Product Manager e: michael.shi@logdna.com

mdeltito commented 3 years ago

minor comments but LGTM otherwise, nice work :+1: