-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a module for loading Prometheus rules.
Save Prometheus URL and user id to SSM
- Loading branch information
Showing
5 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
resource "terraform_data" "this" { | ||
count = length(var.prometheus_rule_files) | ||
|
||
triggers_replace = { | ||
always_run = filemd5(var.prometheus_rule_files[count.index]) # Only run when the file changes | ||
} | ||
|
||
provisioner "local-exec" { | ||
command = "mimirtool rules load --address=${var.prometheus_url} --id=${var.prometheus_user_id} --key=${var.rules_management_access_token} ${var.prometheus_rule_files[count.index]}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
variable "prometheus_rule_files" { | ||
description = "Path to the yaml files with Prometheus rules" | ||
type = list(string) | ||
} | ||
|
||
variable "prometheus_url" { | ||
description = "Prometheus URL" | ||
type = string | ||
} | ||
|
||
variable "prometheus_user_id" { | ||
description = "Prometheus User ID" | ||
type = string | ||
} | ||
|
||
variable "rules_management_access_token" { | ||
description = "Token" | ||
type = string | ||
sensitive = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
terraform { | ||
required_version = ">= 1.3.0, < 1.6.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
terraform { | ||
required_version = ">= 1.8.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters