terraform-provider-grafana icon indicating copy to clipboard operation
terraform-provider-grafana copied to clipboard

Unable to create mute timing for All hours, All Days, All Years, etc...

Open TalonZA opened this issue 3 years ago • 4 comments

Terraform Version

  • Terraform: Terraform v1.2.0
  • Terraform Grafana Provider: 1.28.1
  • Grafana: v9.1.0

Affected Resource(s)

  • grafana_mute_timing

Configuration

resource "grafana_mute_timing" "mute_all" { provider = grafana.MyProject name = "All" intervals {} }

Panic Output

Panic Output GIST Link

Expected Behavior

What should have happened? It should have created a mute timing for All Hours, All Days, All Years (24/7 mute timing)

Actual Behavior

What actually happened? Plugin threw and error

Steps to Reproduce

Please list the steps required to reproduce the issue, for example: terraform apply Answer yes to apply

Important Factoids

Running Grafana on AWS ECS

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example: Nope, not that I could find

TalonZA avatar Sep 12 '22 11:09 TalonZA

When leaving the "intervals" out completely, it creates a mute_timing without any intervals which is not desired. See below: image

When creating this manually, it works and is what I want

image

TalonZA avatar Sep 12 '22 11:09 TalonZA

Work around is to define at least something in the intervals. I defined every day of the week, and it worked.

resource "grafana_mute_timing" "mute_all" {
  provider = grafana.Mopane
  name     = "All"
  intervals {
    weekdays = ["saturday", "sunday", "monday", "tuesday", "wednesday", "thursday", "friday"]
  }
}

TalonZA avatar Sep 12 '22 11:09 TalonZA

Hi! :wave: Thanks for reporting this!

This certainly seems to be a bug. It's a bit surprising as to what representations the API uses to signify "all" vs "none" of the given period type. For instance, the UI actually sends an empty slice for times if not specified, but the empty slice appears to have a different meaning for the other time ranges. The panic seems to be a result of this.

I think we'll need to add a special case for this one. Let me put a PR together.

alexweav avatar Sep 14 '22 21:09 alexweav

Thanks for taking a look at this.

I think what you say makes a lot of sense and in the system, even the interpretation is different from what is shown in the UI. For example. I have that "All" mute timing specified above, and in my SIT and UAT testing environments, I have all the notification policies set to use that mute timing. The expected result would be that I should never get any notifications sent from those environments whilst I can still observe them in the UI. But, notifications are still being sent regardless of this setting.

So, the UI is saying that mute timing applies to all times, but, in fact, is it maybe none of the time?

TalonZA avatar Sep 26 '22 14:09 TalonZA