Skip to content

fix(observability/alertgroup): for_each#1239

Open
mitterle-sit wants to merge 1 commit intostackitcloud:mainfrom
mitterle-sit:fix/alertgroup-for-each
Open

fix(observability/alertgroup): for_each#1239
mitterle-sit wants to merge 1 commit intostackitcloud:mainfrom
mitterle-sit:fix/alertgroup-for-each

Conversation

@mitterle-sit
Copy link
Contributor

Description

Using for_each with the stackit_observability_alertgroup broke with the version v0.81.0.

Error:

Error: Value Conversion Error
│ 
│   with stackit_observability_alertgroup.alert_rule_debug,
│ An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:
│ 
│ Received unknown value, however the target type cannot handle unknown values. Use the corresponding `types` package type or a custom type that handles unknown values.
│ 
│ Path: 
│ Target Type: []alertgroup.rule
│ Suggested Type: basetypes.ListValue`

OpenTofu:
OpenTofu v1.11.5
on darwin_arm64

Example:

resource "stackit_observability_instance" "test" {
  name       = "test"
  plan_name  = "Observability-Starter-EU01"
  project_id = "xxxx"
}

locals {
  alert_rule = {
    example1 = {
      name     = "debug-alert-group"
      interval = "60s"
      rules = [
        {
          alert      = "debug-alert-name"
          expression = "kube_node_status_condition{condition=\"Ready\", status=\"false\"} > 0"
          for        = "60s"
          labels = {
            severity = "critical"
          },
          annotations = {
            summary : "example summary"
            description : "example description"
          }
        },
        {
          expression = "kube_node_status_condition{condition=\"Ready\", status=\"false\"} > 0"
          labels = {
            severity = "critical"
          },
          record = "abc"
        },
      ]
    }
  }

}

resource "stackit_observability_alertgroup" "alert_rule_debug" {
  for_each    = local.alert_rule
  instance_id = stackit_observability_instance.test.instance_id
  name        = each.value.name
  project_id  = "xxx"
  rules       = each.value.rules
  interval    = each.value.interval
}

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Acceptance tests got implemented or updated (see e.g. here)
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@mitterle-sit mitterle-sit requested a review from a team as a code owner February 18, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments