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

TF plan always shows changes on google_monitoring_alert_policy #10042

Closed
tm185187 opened this issue Sep 9, 2021 · 4 comments
Closed

TF plan always shows changes on google_monitoring_alert_policy #10042

tm185187 opened this issue Sep 9, 2021 · 4 comments

Comments

@tm185187
Copy link

tm185187 commented Sep 9, 2021

Affected Resource(s)

  • google_monitoring_alert_policy

Hello,

On use of resource "google_monitoring_alert_policy" TF google resource to create a alerting policy with Terraform, it always shows + cross_series_reducer = "REDUCE_NONE getting added and TF plan shows has been changed.

resource "google_monitoring_alert_policy" "backend_restart_count_alert" {
  project               = var.project
  combiner              = "OR"
  display_name          = "Backend pod keeps restarting"
  notification_channels = []
  conditions {
    display_name = "Restart count"
    condition_threshold {
      filter          = "metric.type=\"logging.googleapis.com/user/BB_ENT_PRD_A_child_container_failed_during_start_catalina\" resource.type=\"gce_instance\""
      duration        = "60s"
      comparison      = "COMPARISON_GT"
      threshold_value = 5
      aggregations {
        alignment_period     = "60s"
        per_series_aligner   = "ALIGN_RATE"
        cross_series_reducer = "REDUCE_NONE"
      }
    }
  }
}

Plan output

resource "google_monitoring_alert_policy" "logging_alert_policy" {
        id                    = "projects/dbk-ref1-global-sre/alertPolicies/16007304137780151117"
        name                  = "projects/dbk-ref1-global-sre/alertPolicies/16007304137780151117"
        # (7 unchanged attributes hidden)

      ~ conditions {
            name         = "projects/dbk-ref1-global-sre/alertPolicies/16007304137780151117/conditions/16007304137780151806"
            # (1 unchanged attribute hidden)

          ~ condition_threshold {
                # (4 unchanged attributes hidden)

              ~ aggregations {
                  + cross_series_reducer = "REDUCE_NONE"
                    # (3 unchanged attributes hidden)
                }

                # (1 unchanged block hidden)
            }
        }

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

b/275101455

@tm185187 tm185187 added the bug label Sep 9, 2021
@slevenick
Copy link
Collaborator

Are you sure this cross series reducer type of REDUCE_NONE is applicable for this policy? The docs note that

"Not all reducer functions may be applied to all time series, depending on the metric type and the value type of the original time series."

I'm guessing that if it is not applicable for some reason the API does not save the input value? I'm saying this because we have tests that set the cross_series_reducer field and it seems to work correctly in some cases

@tm185187
Copy link
Author

This only happens when you have selected cross_series_reducer as REDUCE_NONE for log-based metric alerting. Other aggregators are fine.

@melinath
Copy link
Collaborator

This was the same issue as #12721, which has been resolved.

@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 May 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants