Skip to content

Latest commit

 

History

History
314 lines (269 loc) · 7.11 KB

azurerm_monitor_scheduled_query_rules_alert.md

File metadata and controls

314 lines (269 loc) · 7.11 KB

azurerm_monitor_scheduled_query_rules_alert

back

Index

Terraform

terraform {
  required_providers {
    azurerm = ">= 2.54.0"
  }
}

top

Example Usage

module "azurerm_monitor_scheduled_query_rules_alert" {
  source = "./modules/azurerm/r/azurerm_monitor_scheduled_query_rules_alert"

  # authorized_resource_ids - (optional) is a type of set of string
  authorized_resource_ids = []
  # data_source_id - (required) is a type of string
  data_source_id = null
  # description - (optional) is a type of string
  description = null
  # enabled - (optional) is a type of bool
  enabled = null
  # frequency - (required) is a type of number
  frequency = null
  # location - (required) is a type of string
  location = null
  # name - (required) is a type of string
  name = null
  # query - (required) is a type of string
  query = null
  # query_type - (optional) is a type of string
  query_type = null
  # resource_group_name - (required) is a type of string
  resource_group_name = null
  # severity - (optional) is a type of number
  severity = null
  # tags - (optional) is a type of map of string
  tags = {}
  # throttling - (optional) is a type of number
  throttling = null
  # time_window - (required) is a type of number
  time_window = null

  action = [{
    action_group           = []
    custom_webhook_payload = null
    email_subject          = null
  }]

  timeouts = [{
    create = null
    delete = null
    read   = null
    update = null
  }]

  trigger = [{
    metric_trigger = [{
      metric_column       = null
      metric_trigger_type = null
      operator            = null
      threshold           = null
    }]
    operator  = null
    threshold = null
  }]
}

top

Variables

variable "authorized_resource_ids" {
  description = "(optional)"
  type        = set(string)
  default     = null
}

variable "data_source_id" {
  description = "(required)"
  type        = string
}

variable "description" {
  description = "(optional)"
  type        = string
  default     = null
}

variable "enabled" {
  description = "(optional)"
  type        = bool
  default     = null
}

variable "frequency" {
  description = "(required)"
  type        = number
}

variable "location" {
  description = "(required)"
  type        = string
}

variable "name" {
  description = "(required)"
  type        = string
}

variable "query" {
  description = "(required)"
  type        = string
}

variable "query_type" {
  description = "(optional)"
  type        = string
  default     = null
}

variable "resource_group_name" {
  description = "(required)"
  type        = string
}

variable "severity" {
  description = "(optional)"
  type        = number
  default     = null
}

variable "tags" {
  description = "(optional)"
  type        = map(string)
  default     = null
}

variable "throttling" {
  description = "(optional)"
  type        = number
  default     = null
}

variable "time_window" {
  description = "(required)"
  type        = number
}

variable "action" {
  description = "nested block: NestingList, min items: 1, max items: 1"
  type = set(object(
    {
      action_group           = set(string)
      custom_webhook_payload = string
      email_subject          = string
    }
  ))
}

variable "timeouts" {
  description = "nested block: NestingSingle, min items: 0, max items: 0"
  type = set(object(
    {
      create = string
      delete = string
      read   = string
      update = string
    }
  ))
  default = []
}

variable "trigger" {
  description = "nested block: NestingList, min items: 1, max items: 1"
  type = set(object(
    {
      metric_trigger = list(object(
        {
          metric_column       = string
          metric_trigger_type = string
          operator            = string
          threshold           = number
        }
      ))
      operator  = string
      threshold = number
    }
  ))
}

top

Resource

resource "azurerm_monitor_scheduled_query_rules_alert" "this" {
  # authorized_resource_ids - (optional) is a type of set of string
  authorized_resource_ids = var.authorized_resource_ids
  # data_source_id - (required) is a type of string
  data_source_id = var.data_source_id
  # description - (optional) is a type of string
  description = var.description
  # enabled - (optional) is a type of bool
  enabled = var.enabled
  # frequency - (required) is a type of number
  frequency = var.frequency
  # location - (required) is a type of string
  location = var.location
  # name - (required) is a type of string
  name = var.name
  # query - (required) is a type of string
  query = var.query
  # query_type - (optional) is a type of string
  query_type = var.query_type
  # resource_group_name - (required) is a type of string
  resource_group_name = var.resource_group_name
  # severity - (optional) is a type of number
  severity = var.severity
  # tags - (optional) is a type of map of string
  tags = var.tags
  # throttling - (optional) is a type of number
  throttling = var.throttling
  # time_window - (required) is a type of number
  time_window = var.time_window

  dynamic "action" {
    for_each = var.action
    content {
      # action_group - (required) is a type of set of string
      action_group = action.value["action_group"]
      # custom_webhook_payload - (optional) is a type of string
      custom_webhook_payload = action.value["custom_webhook_payload"]
      # email_subject - (optional) is a type of string
      email_subject = action.value["email_subject"]
    }
  }

  dynamic "timeouts" {
    for_each = var.timeouts
    content {
      # create - (optional) is a type of string
      create = timeouts.value["create"]
      # delete - (optional) is a type of string
      delete = timeouts.value["delete"]
      # read - (optional) is a type of string
      read = timeouts.value["read"]
      # update - (optional) is a type of string
      update = timeouts.value["update"]
    }
  }

  dynamic "trigger" {
    for_each = var.trigger
    content {
      # operator - (required) is a type of string
      operator = trigger.value["operator"]
      # threshold - (required) is a type of number
      threshold = trigger.value["threshold"]

      dynamic "metric_trigger" {
        for_each = trigger.value.metric_trigger
        content {
          # metric_column - (required) is a type of string
          metric_column = metric_trigger.value["metric_column"]
          # metric_trigger_type - (required) is a type of string
          metric_trigger_type = metric_trigger.value["metric_trigger_type"]
          # operator - (required) is a type of string
          operator = metric_trigger.value["operator"]
          # threshold - (required) is a type of number
          threshold = metric_trigger.value["threshold"]
        }
      }

    }
  }

}

top

Outputs

output "id" {
  description = "returns a string"
  value       = azurerm_monitor_scheduled_query_rules_alert.this.id
}

output "this" {
  value = azurerm_monitor_scheduled_query_rules_alert.this
}

top