Skip to content

Provision Grafana On Call Teams #540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alekhrycaiko opened this issue Jun 30, 2022 · 9 comments
Closed

Provision Grafana On Call Teams #540

alekhrycaiko opened this issue Jun 30, 2022 · 9 comments
Assignees

Comments

@alekhrycaiko
Copy link
Contributor

alekhrycaiko commented Jun 30, 2022

Hi there,

I've noticed there's a data resource for retrieving a grafana on call team, but there is no accompanying resource for building an on call team with Terraform. In addition, it seems that this resource is different and not interchangeable with the grafana_team resource.

Would it be possible to add a grafana_oncall team resource, or make that creation possible through the grafana_team resource?

Thanks!

@julienduchesne
Copy link
Contributor

@Konstantinov-Innokentii @Ferril FYI

julienduchesne added a commit that referenced this issue Sep 7, 2022
Closes #540
They are in fact Grafana teams but with a different ID
Add an example about that + a test
@julienduchesne
Copy link
Contributor

They are somewhat interchangeable with Grafana teams, see the docs here: #639.

I tried to do it completely programatically but it seems that OnCall is missing a "sync" api endpoint (unless I just couldn't find it)

@alekhrycaiko
Copy link
Contributor Author

Curious if there's any movement here. I still find this rather problematic, as I'd like to have a module that can provision me a Grafana team, the accompanying on call team and any relevant on call resources. That currently is not possible since there is no resource for the grafana_on_call team.

@Konstantinov-Innokentii
Copy link
Contributor

Konstantinov-Innokentii commented Mar 8, 2023

Hello @alekhrycaiko. You are right, there is no resource for that, but there is data source for that. So, what you can do is:

  1. Create grafana_team resource and appy tf configuration
  2. Create grafana_oncall_team datasource, pointing on that team and use it in oncall resources.

@julienduchesne We added a sync between OnCall and Grafana on terraform calls to the oncall teams endpoint, so it should work programmaticaly. (However, we don't trigger that sync on each request, so sometimes you need an extra try after several minutes)

I understand, that it's not very convenient, but that's the bottleneck of current OnCall architecture. We are looking to make users/teams thing more "normalized" with grafana.

@project0
Copy link

project0 commented Mar 9, 2023

@Konstantinov-Innokentii see #843, the grafana_oncall_team data source is not working.

@Konstantinov-Innokentii
Copy link
Contributor

@project0 I just was able to apply following tf configuration:

data "grafana_oncall_team" "test" {
  provider = grafana.oncall
  name = "test-on-call"
}



resource "grafana_oncall_schedule" "platform_oncall" {
  provider = grafana.oncall
  team_id  = data.grafana_oncall_team.test.id
  time_zone  = "Europe/Paris"
  name = "Platform"
  type = "calendar"
  shifts = [
  ]
}

Please, use grafana_oncall_team datasource id, when passing it as team_id argument to oncall resources. If grafana_oncall_team datasource read fails with 404 just retry terraform apply in a minute, sometimes oncall needs time to sync teams with grafana. We are working on more "smooth" process for that.

@alekhrycaiko
Copy link
Contributor Author

Maybe the automatic sync is possible with some delay like Konstantinov is mentioning.

But if you don't want to wait... I've found it successful previously to navigate into the UI and access the Grafana on call team @project0. When doing that the data attribute should plan successfully. Hopefully that helps!

@alekhrycaiko
Copy link
Contributor Author

Hi @julienduchesne or @Konstantinov-Innokentii I'm curious if this is still blocked and whether any progress is possible?

I did see grafana/oncall#1180 this got merged in. Is there possibility now to move forward?

@julienduchesne
Copy link
Contributor

As shown by the test case added here: #1477, the grafana_oncall_team datasource now works immediately after a team's creation so I'll close this issue

I'm leaving #1003 open to cover the case of managing a team's settings

@julienduchesne julienduchesne self-assigned this Apr 10, 2024
julienduchesne added a commit that referenced this issue Apr 15, 2024
Follow-up to #540
Most of the time the datasource finds a team that was just created, but sometimes it takes a short time for the API to sync
With a retry, it shouldn't be flaky anymore
julienduchesne added a commit that referenced this issue Apr 15, 2024
Follow-up to #540
Most of the time the datasource finds a team that was just created, but sometimes it takes a short time for the API to sync
With a retry, it shouldn't be flaky anymore
julienduchesne added a commit that referenced this issue Apr 15, 2024
Follow-up to #540
Most of the time the datasource finds a team that was just created, but sometimes it takes a short time for the API to sync
With a retry, it shouldn't be flaky anymore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants