grafana / terraform-provider-grafana

Terraform Grafana provider
https://www.terraform.io/docs/providers/grafana/
Mozilla Public License 2.0
425 stars 225 forks source link

Grafana on call daily shift on time zone != UTC doesn't work #1330

Closed afreyermuth98 closed 5 months ago

afreyermuth98 commented 8 months ago

Terraform Version

Affected Resource(s)

Please list the resources as a list, for example:

Terraform Configuration Files

resource "grafana_oncall_schedule" "schedule" {
  provider         = grafana.oncall
  name             = "my schedule"
  type             = "calendar"
  time_zone        = "Europe/Paris"
  team_id          = data.grafana_oncall_team.team.id # To refer
  shifts = [
    grafana_oncall_on_call_shift.shift.id
  ]
  slack {
    channel_id    = data.grafana_oncall_slack_channel.grafana_oncall_slack_channel.id
    user_group_id = data.grafana_oncall_user_group.slack_user_group.i
  }
}

resource "grafana_oncall_on_call_shift" "shift" {
  provider      = grafana.oncall
  name          = "test shift"
  type          = "rolling_users"
  start         = "2024-01-01T08:00:00"
  duration      = 60 * 60 * 10 # 10 hours
  frequency     = "daily"
  interval      = 1
  by_day        = ["MO", "TU", "WE", "TH", "FR"]
  week_start    = "MO"
  rolling_users = [
    [
      "USER_1"
    ],
    [
      "USER_2"
    ]
  ],
  time_zone     = "Europe/Paris"
}

Expected Behavior

Each of the user have a shift rotation, USER1 on monday, USER2 on tuesday, USER1 on wednesday etc ...

Actual Behavior

The 2 users have a shift every day : USER1 & USER2 on monday, USER1 & USER2 on tuesday etc ...

Steps to Reproduce

  1. terraform apply

Important Factoids

This works when I put time_zoed = "UTC" inside the grafana_oncall_on_call_shift and I get no issues using "weekly" frequency

julienduchesne commented 5 months ago

This seems to be a bug in the API (or UI). UTC works, but so does America/Montreal and America/Los_Angeles and the payload looks to be the same between those and Europe timezone shifts. Can you open an issue here: https://github.com/grafana/oncall/issues?