Skip to content

time_zone blocks changes for schedule of type web and is required for creation despite marked as optional #2425

@dergyitheron

Description

@dergyitheron

Terraform Version

Terraform v1.13.4, OpenTofu v1.10.6

Terraform Grafana Provider Version

4.14.0

Grafana Version

12.1.1

Affected Resource(s)

grafana_oncall_schedule on both creation and modification behaves differently than the documentation describes

Terraform Configuration Files

data "grafana_team" "dvr_test" {
  name = "TEAM-DVR-TEST"
  # name = "TEAM-DEVOPS"
}

data "grafana_oncall_team" "dvr_test" {
  name = data.grafana_team.dvr_test.name
}

resource "grafana_oncall_schedule" "dvr_test_weekly" {
  name     = "DVR-TEST Weekly"
  type     = "web"
  team_id = data.grafana_oncall_team.dvr_test.id
  time_zone = "UTC"
}

Commenting out the time_zone upon creation fails with an error.

After terraform apply with the time_zone, change the team and apply again, error saying time_zone cannot be set for type "web".

Expected Behavior

Resource docs mention time_zone as Optional. It should either be marked as required for web or truly optional.

Based on the recent changes in #2401 it should not yield the error that time_zone cannot be set for type "web" when modifying.

Actual Behavior

When creating a resource without time_zone

Error: POST https://oncall.company.com/api/v1/schedules/: 400 {time_zone: [This field is required.]}

When resource was created with time_zone and is modified, for example changing a team

Error: time_zone can not be set with type: web

Tried to comment out the time_zone or having lifecycle block to ignore it, same result.

Steps to Reproduce

terraform apply to create the schedule from configuration with type = "web" and no time_zone configured

terraform apply the schedule to modify team

Important Factoids

Testing on Grafana OSS with OnCall running on AKS cluster, the integration works as expected, resources can be configured via UI, both used teams are existing in Grafana and OnCall.

Using http backend with self-hosted instance of the latest version of GitLab CE.

Same result with both Terraform and OpenTofu.

References

https://registry.terraform.io/providers/grafana/grafana/4.14.0/docs/resources/oncall_schedule#optional

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions