Skip to content
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

getResourcePermissionsInternalServerError if folder is not present anymore #1339

Closed
JustNZ opened this issue Feb 8, 2024 · 0 comments · Fixed by #1351
Closed

getResourcePermissionsInternalServerError if folder is not present anymore #1339

JustNZ opened this issue Feb 8, 2024 · 0 comments · Fixed by #1351
Labels

Comments

@JustNZ
Copy link

JustNZ commented Feb 8, 2024

Terraform Version

  • Terraform: 1.7.1
  • Terraform Grafana Provider: 2.11.0
  • Grafana: 10.3.0

Affected Resource(s)

  • grafana_folder_permission

Terraform Configuration Files

resource "grafana_folder" "this" {
  title  = title(var.environment)
  uid    = lower(var.environment)
  org_id = var.org_id
}

resource "grafana_folder" "that" {
  for_each          = toset(var.environment_data.stages)
  title             = format("%s %s", var.environment, title(each.value))
  uid               = lower(format("%s_%s", var.environment, each.value))
  parent_folder_uid = grafana_folder.this.uid
  org_id            = var.org_id
}

resource "grafana_folder_permission" "this" {
  folder_uid = grafana_folder.this.uid
  org_id     = var.org_id
  permissions {
    role       = "Editor"
    permission = "View"
  }
}

Debug Output

Error: error reading folder permissions with ID`1:loki`: [GET /access-control/{resource}/{resourceID}][500] getResourcePermissionsInternalServerError {"message":"failed to get permissions"}
│ 
│   with module.grafana.module.infra["loki"].grafana_folder_permission.this,
│   on /home/user/git/terraform-modules/modules/grafana/modules/infra/folder.tf line 15, in resource "grafana_folder_permission" "this":
│   15: resource "grafana_folder_permission" "this" {

Expected Behavior

Ignore get of folder permissions if folder is not existing anymore on grafana

Actual Behavior

Fails to get permissions because folder is deleted on grafana

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply
@JustNZ JustNZ added the bug label Feb 8, 2024
julienduchesne added a commit that referenced this issue Feb 15, 2024
Closes #1339
Currently, the provider will try to fetch the permissions but it crashes because the folder is gone
Also, I gave random names to the test resources because I had a bit of trouble with conflicts locally
julienduchesne added a commit that referenced this issue Feb 23, 2024
Closes #1339
Currently, the provider will try to fetch the permissions but it crashes because the folder is gone
Also, I gave random names to the test resources because I had a bit of trouble with conflicts locally
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant