Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example of usage of alert_strategy for google_monitoring_alert_policy #12016

Closed
dxk185 opened this issue Jul 4, 2022 · 5 comments
Closed

example of usage of alert_strategy for google_monitoring_alert_policy #12016

dxk185 opened this issue Jul 4, 2022 · 5 comments
Assignees
Labels

Comments

@dxk185
Copy link

dxk185 commented Jul 4, 2022

Hi Team,

I could not get a good example of using alert_strategy option for google_monitoring_alert_policy, resource.
The documentation https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/monitoring_alert_policy#nested_alert_strategy, is not clear on this either.
I keep on getting this error message :

Error: Unsupported block type
Blocks of type "alert_strategy" are not expected here.

The pseudo code is:

resource "google_monitoring_alert_policy" "" {
project =
display_name =
combiner = "OR"
conditions {
display_name =
condition_threshold {
filter =
duration = "60s"
comparison = "COMPARISON_GT"
aggregations {
alignment_period = "60s"
per_series_aligner = DELTA_ALIGN
cross_series_reducer = "REDUCE_COUNT"
}
trigger {
count = "1"
}
}
}
alert_strategy {
auto_close = "1800s"
}
notification_channels =
depends_on = [
google_logging_metric.
]
}

@dxk185 dxk185 added the question label Jul 4, 2022
@edwardmedia edwardmedia self-assigned this Jul 7, 2022
@edwardmedia
Copy link
Contributor

@dxk185 how about this?

resource "google_monitoring_alert_policy" "alert_policy" {
    display_name = "My Alert Policy"
    combiner     = "OR"
    conditions {
        display_name = "test condition"
        condition_threshold {
            filter     = "metric.type=\"compute.googleapis.com/instance/disk/write_bytes_count\" AND resource.type=\"gce_instance\""
            duration   = "60s"
            comparison = "COMPARISON_GT"
            aggregations {
            alignment_period   = "60s"
            per_series_aligner = "ALIGN_RATE"
            }
        }

    }

    alert_strategy {
        auto_close = true
    }

    user_labels = {
        foo = "bar"
    }
}

@dxk185
Copy link
Author

dxk185 commented Jul 11, 2022

Thank you for the response. However from the response explanation, it is just the same position where I have provided the "alert_strategy" block as well. That is just outside the "conditions" block. The same level as in "display_name".

@edwardmedia
Copy link
Contributor

@dxk185 what do you try to do?

@edwardmedia
Copy link
Contributor

@dxk185 it should work as configured like this. Closing this question then.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants