Skip to content

Whitespace at the end of an alert-expression for observability let the provider fail. #1038

@eBeyond

Description

@eBeyond

Description

I've created an alert rule for observability:

    {
      alert      = "ThanosQueryingPartialResponsesAbort"
      expression = "avg_over_time(thanos_rule_evaluation_with_warnings_total{strategy=\"abort\"} [30m:]) > 0 "
      for        = "30m"

      labels = {
        severity = "warning"
      }

      annotations = {
        description = "Thanos-Ruler detected rules or alerts with evaluations ending with an 'abort'. (within the last 30m, only relevant when using partial response strategy)"
      }
    }

This failed with the following result:

Error: Provider produced inconsistent result after apply
  │ 
  │ When applying changes to
  │ module.alerts.stackit_observability_alertgroup.thanosruler[0], provider
  │ "module.alerts.provider[\"[registry.opentofu.org/stackitcloud/stackit\](http://registry.opentofu.org/stackitcloud/stackit%5C)"]"
  │ produced an unexpected new value: .rules[4].expression: was
  │ cty.StringVal("avg_over_time(thanos_rule_evaluation_with_warnings_total{strategy=\"abort\"}
  │ [30m:]) > 0 "), but now
  │ cty.StringVal("avg_over_time(thanos_rule_evaluation_with_warnings_total{strategy=\"abort\"}
  │ [30m:]) > 0").
  │ 
  │ This is a bug in the provider, which should be reported in the provider's
  │ own issue tracker.

It seems that it has issues with the whitespace at the end of the expression. If the whitespace is removed, everything works as expected.

Expected behavior

If the whitespace is available it should work as expected. It could do a refresh, if the whitespace wasn't available before. The provider should be more resilient regarding this kind of issues.

Environment

  • OS: Azure-Devops
  • Tofu version: 1.9.1
  • Terragrund version: v0.80.4
  • Version of the STACKIT Terraform provider: v0.51.0

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