• Alerting
• Product edition: Terraform versions 3.0.0 and below
• Feature Category:Alert creation and modification via Terraform
Problem Description:
For multi-threshold alerts, while performing an update via terraform the alert condition expression is removed.
Example:
- condition = "ts(aws.ebs.burstbalance, tag=\"prod\")" -> null
conditions = { "info" = "ts(aws.ebs.burstbalance, tag=\"prod\") <= 90"
"severe" = "ts(aws.ebs.burstbalance, tag=\"prod\") <= 25"
"smoke" = "ts(aws.ebs.burstbalance, tag=\"prod\") <= 80"
"warn" = "ts(aws.ebs.burstbalance, tag=\"prod\") <= 50" }
Note: This issue has been verified with Terraform versions 2.7.3 and 3.0.0.
Verification:
- Removal of the condition expression will not impact the multi-threshold alerts, as the condition expression is not used in the multi-threshold alerts.
- Verified that multi-threshold alerts are functioning as expected.
- For multi-threshold alerts, the alerting engine uses the display expression to define the severities. As long as the display expression is not null there should be no difference in the way alerts are executed.
Resolution:
The issue is resolved in the new Terraform Provide version available at
https://registry.terraform.io/providers/vmware/wavefront/3.0.1
Once implemented, you can revert the changes mentioned in the workaround (if applied) as the updated provider version will remedy the issue.
Workarounds:
We highly recommend upgrading to the new Terraform Provider version. If you are still using Terraform 3.0.0 or below, please see the workaround below:
Add the following line in your Terraform file for a THRESHOLD alert
lifecycle { ignore_changes = [ condition ] }
Example
resource "test_alert" "mac_cpu_usage_over_ninety_percent" { name = "Mac CPU Usage Over 90%" alert_type = "THRESHOLD" display_expression = "100 - avg(ts(\"mac.cpu.usage.idle\", source=\"foo.bar\"))" conditions = { "severe" = "100 - avg(ts(\"mac.cpu.usage.idle\", source=\"foo.bar\")) > 90"
"warn" = "100 - avg(ts(\"mac.cpu.usage.idle\", source=\"foo.bar\")) > 80" } additional_information = "This is a sample alert created by terraform. It monitors the CPU Usage and fires when it's over 90%." minutes = 5 resolve_after_minutes = 5 threshold_targets = { "severe" = "target:${test_alert_target.test_target.id}" } tags = ["local.mac"] lifecycle { ignore_changes = [ condition ] } }
Comments