Skip to content

Commit

Permalink
adding variables
Browse files Browse the repository at this point in the history
  • Loading branch information
MOHAMMED-ho committed Nov 13, 2024
1 parent fd072a8 commit c9648b6
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 38 deletions.
24 changes: 12 additions & 12 deletions dynatrace_alerts.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ resource "dynatrace_alerting" "my_alerting_profile" {
filter {
custom {
description {
operator = "CONTAINS"
value = "CapacityUnits"
case_sensitive = true
enabled = true
operator = var.operator
value = var.value
case_sensitive = var.case_sensitive
enabled = var.enabled
}
title {
operator = "CONTAINS"
value = "CapacityUnits"
case_sensitive = true
enabled = true
operator = var.operator
value = var.value
case_sensitive = var.case_sensitive
enabled = var.enabled

}

Expand All @@ -22,10 +22,10 @@ resource "dynatrace_alerting" "my_alerting_profile" {
}
rules {
rule {
include_mode = "INCLUDE_ALL"
tags = ["test:test"]
delay_in_minutes = 1
severity_level = "CUSTOM_ALERT"
include_mode = var.include_mode
tags = var.tags
delay_in_minutes = var.delay_in_minutes
severity_level = var.severity_level
}
}
}
Expand Down
32 changes: 16 additions & 16 deletions dynatrace_metric_events.tf
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
# Creates a Dynatrace Management Zone
resource "dynatrace_management_zone_v2" "Alerting_Test_MZ" {
name = "Alerting_Test_MZ"
name = var.management_zone_name
rules {
rule {
type = "ME"
enabled = true
entity_selector = ""
type = var.rule_type
enabled = var.enabled
entity_selector = var.entity_selector
attribute_rule {
entity_type = "WEB_APPLICATION"
entity_type = var.entity_type
attribute_conditions {
condition {
case_sensitive = false
key = "WEB_APPLICATION_NAME"
operator = "CONTAINS"
string_value = "test"
case_sensitive = var.case_sensitive
key = var.key
operator = var.operator
string_value = var.string_value
}
}
}
}
rule {
type = "ME"
enabled = true
entity_selector = ""
type = var.rule_type
enabled = var.enabled
entity_selector = var.entity_selector
attribute_rule {
entity_type = "WEB_APPLICATION"
entity_type = var.entity_type
attribute_conditions {
condition {
case_sensitive = true
key = "WEB_APPLICATION_NAME"
operator = "CONTAINS"
string_value = "www.test.com"
key = var.key
operator = var.operator
string_value = var.string_value
}
}
}
Expand Down
39 changes: 29 additions & 10 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,46 @@ variable "slack_notification_enabled" {
variable "slack_notification_name" {
type = string
}
variable "elasticache_owner_name" {
variable "operator" {
type = string
}
variable "elasticache_shared" {
variable "value" {
type = string
}
variable "elasticache_dashboard_name" {
type = string
variable "case_sensitive" {
type = bool
}
variable "elasticache_preset" {
variable "enabled" {
type = bool
}
variable "dynamodb_owner_name" {
variable "include_mode" {
type = string
}
variable "tags" {
type = list(string)
}

variable "severity_level" {
type = string
}
variable "dynamodb_shared" {
variable "management_zone_name" {
type = string
}
variable "dynamodb_dashboard_name" {
variable "rule_type" {
type = string
}
variable "dynamodb_preset" {
type = bool
variable "entity_selector" {
type = string
}
variable "entity_type" {
type = string
}
variable "key" {
type = string
}
variable "string_value" {
type = string
}
variable "delay_in_minutes" {
type = string
}

0 comments on commit c9648b6

Please sign in to comment.