diff --git a/_dynatrace-base-modules/dynatrace-custom-anomalies/_interface.tf b/_dynatrace-base-modules/dynatrace-custom-anomalies/_interface.tf new file mode 100644 index 0000000..2b39ece --- /dev/null +++ b/_dynatrace-base-modules/dynatrace-custom-anomalies/_interface.tf @@ -0,0 +1,23 @@ +# General Variables +variable "name" { default = "" } +variable "description" { default = "The {metricname} value of {severity} was {alert_condition} your custom threshold of {threshold}." } +variable "ownerMail" { default = "" } + +variable "enabled" { default = true } //currently nothing else possible + +#Target and warning percentage of the SLO as integer +variable "severity" { default = "CUSTOM_ALERT" } + +#Metrics to be evaluated, must result in a percentage metric +variable "metric_selector" { default = "" } + +variable "alert_condition" { default = "BELOW" } +variable "alerting_on_missing_data" { default = true } +variable "dealerting_samples" { default = 15 } +variable "samples" { default = 15 } +variable "threshold" { default = 10 } +variable "unit" { default = "UNSPECIFIED" } +variable "violating_samples" { default = 5 } + + + diff --git a/_dynatrace-base-modules/dynatrace-custom-anomalies/dynatrace-custom-anomalies.tf b/_dynatrace-base-modules/dynatrace-custom-anomalies/dynatrace-custom-anomalies.tf new file mode 100644 index 0000000..24c2eab --- /dev/null +++ b/_dynatrace-base-modules/dynatrace-custom-anomalies/dynatrace-custom-anomalies.tf @@ -0,0 +1,26 @@ +terraform { +required_providers { + dynatrace = { + version = "1.11.0" + source = "dynatrace-oss/dynatrace" + } + } +} +resource dynatrace_custom_anomalies main { + name = "${var.name}" + description = "${var.description}" + enabled = "${var.enabled}" + metric_selector = trimspace("${var.metric_selector}") + severity = "${var.severity}" + strategy { + static { + alert_condition = "${var.alert_condition}" + alerting_on_missing_data = "${var.alerting_on_missing_data}" + dealerting_samples = "${var.dealerting_samples}" + samples = "${var.samples}" + threshold = "${var.threshold}" + unit = "${var.unit}" + violating_samples = "${var.violating_samples}" + } + } +}