gessnerfl / terraform-provider-instana

Terraform provider implementation for Instana REST API
Apache License 2.0
29 stars 16 forks source link

Support Application Alert Configs #74

Closed martinei closed 2 years ago

martinei commented 4 years ago

I am in the need to support Application Alert Configs. I have created a branch that currently does just enough for me: https://github.com/martinei/terraform-provider-instana/tree/application_config_alerts

I am aware this is not "good enough" to be merged, but maybe it is still useful for someone or can serve as a starting point.

gessnerfl commented 4 years ago

@martinei is this an officially supported feature? I cannot find details about the API in the current API documentation: https://instana.github.io/openapi/

martinei commented 4 years ago

Ups. I think it is still in beta/preview.

becjon commented 3 years ago

Application Alert Configs are part of the openapi spec now. But It is still in Beta

https://instana.github.io/openapi/#tag/Application-Alert-Configuration

We are very interested in this feature

gessnerfl commented 3 years ago

Want to support this feature with milestone 1.1.0. I'm currently working on 1.0.0 which will migrate the provider to the new SDK. I want to support imports in this release to follow terraform best practices. Afterwards I will work on this feature.

gessnerfl commented 3 years ago

@martinei I had a look into your implementation.However it seems that there major changes on the API. I will revisit this feature request once the feature is stable.

martinei commented 3 years ago

Thanks for the update! I haven't touched this for some time an the API was not yet public when I initially wrote this. So I may well have stopped working.

destaben commented 3 years ago

@martinei could you provide an example of any working configuration with instana_application_alert_config? I'm trying to get a valid configuration with all required values from your code, but I always get -> Body: {"code":400,"message":"Unable to process JSON"}

Thanks!

martinei commented 3 years ago

This is roughly what we use. Please note that the code does not support all options. It will probably need changes to match your use case.

resource instana_application_alert_config testalert {
  application_id = // Id of the application to which the alert shall be added

  description = "Latency to high"
  alert_name = "Latency to high"

  tag_filter {
    name = "endpoint.name"
    operator = "EQUALS"
    string_value = "some endpoint name"
    entity = "NOT_APPLICABLE"
  }

  tag_filter {
    name = "service.name"
    operator = "EQUALS"
    string_value = "some service name"
    entity = "NOT_APPLICABLE"
  }

  rule_alert_type = "slowness"
  rule_metric_name = "latency"
  rule_aggregation = "P95"

  threshold_value = 200
  threshold_type = "staticThreshold"
  threshold_operator = ">="

  integration_ids = [
    // a Channel Id
   ]
}
destaben commented 3 years ago

Thanks @martinei, it's working!