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

[Bug]: Inconsistent Final Plan w/ Folder Permissions #1888

Open
Folling opened this issue Nov 5, 2024 · 0 comments
Open

[Bug]: Inconsistent Final Plan w/ Folder Permissions #1888

Folling opened this issue Nov 5, 2024 · 0 comments

Comments

@Folling
Copy link

Folling commented Nov 5, 2024

Terraform Version

1.9.8

Terraform Grafana Provider Version

3.12.0

Grafana Version

11.0.0

Affected Resource(s)

  • grafana_folder_permission

Terraform Configuration Files

data "grafana_folder" "parent_folder" {
  count = var.parent_folder_name == null ? 0 : 1

  title = var.parent_folder_name
}

resource "grafana_folder" "folder" {
  title                        = var.title
  uid                          = var.uid
  prevent_destroy_if_not_empty = true
  parent_folder_uid            = var.parent_folder_name == null ? null : data.grafana_folder.parent_folder[0].uid
}

data "grafana_team" "admin_teams" {
  for_each = var.admin_teams

  name = each.key
}

resource "grafana_folder_permission" "team_folder_permission" {
  folder_uid = grafana_folder.folder.uid

  permissions {
    role       = "Admin"
    permission = "Admin"
  }

  permissions {
    role       = "Viewer"
    permission = "View"
  }

  permissions {
    role       = "Editor"
    permission = "View"
  }

  dynamic "permissions" {
    for_each = var.admin_teams

    content {
      team_id    = data.grafana_team.admin_teams[permissions.key].id
      permission = "Admin"
    }
  }
}

Expected Behavior

It should work 100% of the time, but every now and then it randomly breaks with an error.

Actual Behavior

Fails with:

│ Error: Provider produced inconsistent final plan
│ 
│ When expanding the plan for
│ module.team_folder["redacted"].grafana_folder_permission.team_folder_permission
│ to include new values learned so far during apply, provider
│ "registry.terraform.io/grafana/grafana" produced an invalid new value for
│ .permissions: planned set element
│ cty.ObjectVal(map[string]cty.Value{"permission":cty.StringVal("Admin"),
│ "role":cty.StringVal(""), "team_id":cty.UnknownVal(cty.String),
│ "user_id":cty.StringVal("0")}) does not correlate with any element in
│ actual.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

Steps to Reproduce

No response

Important Factoids

Terraform is run through an Azure Pipeline, grafana is selfhosted in an Azure App Service. Nested Folders are enabled.

References

No response

@Folling Folling added the bug label Nov 5, 2024
@Duologic Duologic removed the bug label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants