We have a monitoring alert policy in GCP which we configured in Terraform. We also want to create a documentation using Terraform.
We are creating documentation using following command in GCP.
gcloud alpha monitoring policies update projects/project_name/alertPolicies/5861347861929375791 \
--documentation-format="text/markdown" \
--documentation="API has exceeded its quota limit. The systems load has increased beyond capacity, consider increasing your Global and Regional quotas. If this is unexpected behaviour, validate that this is not a bug within your platform."
Is there any way we can create the same in Terraform?
Configuration for Monitoring Policy:
# Alerts when API seeing errors
resource "google_monitoring_alert_policy" "dlp_api_see_errors" {
project = PROJECT_NAME
display_name = "API is seeing errors"
combiner = "OR"
conditions {
display_name = "API is seeing errors"
condition_threshold {
filter = "metric.type=\"serviceruntime.googleapis.com/api/request_count\" resource.type=\"consumed_api\" metric.label.\"response_code\"!=\"200\" resource.label.\"service\"=\"dlp.googleapis.com\""
duration = "60s"
comparison = "COMPARISON_GT"
aggregations {
alignment_period = "60s"
per_series_aligner = "ALIGN_SUM"
cross_series_reducer = "REDUCE_SUM"
}
trigger {
count = 1
}
}
}
notification_channels = "${concat(google_monitoring_notification_channel.ndw_alerting_email.*.id, google_monitoring_notification_channel.ndw_alerting_phone.*.id)}"
}