Skip to content

Terraform: problem when creating google_monitoring_alert_policy resource  #17296

Description

@frajkallel

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally
    to expedite investigation and resolution of this issue.

Terraform Version

Terraform version: v1.7.3 on linux_amd64.
* provider hashicorp/google v5.16.0
* provider hashicorp/google-beta v5.16.0

Affected Resource(s)

google_monitoring_alert_policy

Terraform Configuration

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # google_monitoring_alert_policy.alert_policy will be created
  + resource "google_monitoring_alert_policy" "alert_policy" {
      + combiner              = "OR"
      + creation_record       = (known after apply)
      + display_name          = "KubePodCrashLooping"
      + enabled               = true
      + id                    = (known after apply)
      + name                  = (known after apply)
      + notification_channels = [
          + "projects/fksbx1/notificationChannels/1604911587509612345",
        ]
      + project               = "fksbx1"
      + severity              = "CRITICAL"

      + alert_strategy {
          + auto_close = "1800s"
        }

      + conditions {
          + display_name = "condition"
          + name         = (known after apply)

          + condition_prometheus_query_language {
              + alert_rule          = "KubePodCrashLooping"
              + duration            = "900s"
              + evaluation_interval = "30s"
              + query               = "rate(kube_pod_container_status_restarts_total{job=\"kube-state-metrics-scraper\",exported_namespace!~\"kube-system|gmp-system|gmp-public|config-management-system|config-management-monitoring|resource-group-system\"}[15m]) * 60 * 5 > 0"
              + rule_group          = "kubernetes-apps"
            }
        }

      + documentation {
          + mime_type = "text/markdown"
          + subject   = "Pod ${metric.label.exported_namespace}/${metric.label.exported_pod} is restarting ${metric.label.value} times/15m."
        }
    }

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

Debug Output

No response

Expected Behavior

Create alert policy

Actual Behavior

google_monitoring_alert_policy.alert_policy: Creating...
╷
│ Error: Error creating AlertPolicy: googleapi: Error 400: Request was missing field alert_policy.documentation.mime_type: non-empty content requires non-empty MIME type and vice versa.
│
│   with google_monitoring_alert_policy.alert_policy,
│   on channel.tf line 11, in resource "google_monitoring_alert_policy" "alert_policy":
│   11: resource "google_monitoring_alert_policy" "alert_policy" {
│ 

Steps to reproduce

  1. terraform apply

Important Factoids

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions