Skip to content

When omitting the email_config in observabilit_instance the fields for smtpSmarthome and smtpAuthIdentity are still validated #1079

@eBeyond

Description

@eBeyond

Description

When running apply on an stackit_observability_instance it complains about wrongly formatted smtpAuthIdentity and smtpSmarthost. They're both not there, because we're not unsing email for alerting.
In the documentation it's stated that the email_config is optional. As such I would expect that even the configuration for it is obsolete. :)

Steps to reproduce

resource "stackit_observability_instance" "default" {
  project_id = var.project_id
  name       = var.name
  plan_name  = "Observability-Large-EU01"

  alert_config = {
    receivers = [{
      name = local.observability_alert_receiver_google_name
      webhooks_configs = [{
        google_chat   = true
        url           = var.google_chat_webhook_url
        send_resolved = true
      }]
      },
      {
        name = local.observability_alert_receiver_opsgenie_name

        opsgenie_configs = [{
          api_key       = var.opsgenie_api_key
          send_resolved = true
        }]
      }
    ]
    route = {
      receiver        = local.observability_alert_receiver_google_name
      group_by        = ["cluster", "severity"]
      group_interval  = "5m"
      group_wait      = "30s"
      repeat_interval = "4h"
      routes = [
        {
          receiver = local.observability_alert_receiver_opsgenie_name
          matchers = [
            "severity=\"critical\""
          ]

        }
      ]
    }
  }

Actual behavior

When running plan and apply it's showing this:

╷
│ Error: Error updating instance
│ 
│   with module.provider_cluster.stackit_observability_instance.default,
│   on ../../modules/provider_cluster/observability.tf line 6, in resource "stackit_observability_instance" "default":
│    6: resource "stackit_observability_instance" "default" {
│ 
│ Setting alert config: json: cannot unmarshal object into Go struct field Error.errors of type []map[string]string, status code 400, Body: {"message":"Alert config is not
│ valid","errors":{"global":{"smtpSmarthost":["***** is not in the allowed characters: a-zA-Z0-9_./@&?:=%-"],"smtpAuthIdentity":["Enter a valid email address."]}}}
│ 
╵

It's notable that within the plan phase no changes to the alert configuration related to email are shown. This issue only comes up within the apply phase.

Expected behavior

stackit_observability_instance should ignore the settings within the configs if they're not used.

Environment

  • OS: macos
  • Tofu version (see tofu version): v1.10.7
  • Version of the STACKIT Terraform provider: v0.71.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions