49 lines
No EOL
1.5 KiB
HCL
49 lines
No EOL
1.5 KiB
HCL
locals {
|
|
basic_auth = base64encode("${stackit_observability_credential.observability_credentials.username}:${stackit_observability_credential.observability_credentials.password}")
|
|
}
|
|
|
|
resource "local_sensitive_file" "alert_configs" {
|
|
content = templatefile("../../monitoring/alerts/dev/alertconfigs.json", {
|
|
msTeamWebhook = var.msTeamWebhook
|
|
})
|
|
filename = ".temp/alertconfigs.json"
|
|
}
|
|
|
|
resource "null_resource" "alert_configs" {
|
|
triggers = {
|
|
config = local_sensitive_file.alert_configs.content_sha1
|
|
url = var.observability_url
|
|
}
|
|
provisioner "local-exec" {
|
|
command = <<EOT
|
|
curl -X PUT "${var.observability_url}/${stackit_observability_instance.observability.instance_id}/alertconfigs" \
|
|
-d @${local_sensitive_file.alert_configs.filename} \
|
|
-H "Authorization: Basic ${local.basic_auth}" \
|
|
-H "Content-Type: application/json" \
|
|
--fail
|
|
EOT
|
|
}
|
|
}
|
|
|
|
resource "local_file" "alert_groups" {
|
|
content = templatefile("../../monitoring/alerts/dev/alertgroups.json", {
|
|
|
|
})
|
|
filename = ".temp/alertgroups.json"
|
|
}
|
|
|
|
resource "null_resource" "alert_groups" {
|
|
triggers = {
|
|
config = local_file.alert_groups.content_sha1
|
|
url = var.observability_url
|
|
}
|
|
provisioner "local-exec" {
|
|
command = <<EOT
|
|
curl -X PUT "${var.observability_url}/${stackit_observability_instance.observability.instance_id}/alertgroups" \
|
|
-d @${local_file.alert_groups.filename} \
|
|
-H "Authorization: Basic ${local.basic_auth}" \
|
|
-H "Content-Type: application/json" \
|
|
--fail
|
|
EOT
|
|
}
|
|
} |