goauthentik / terraform-provider-authentik

Manage https://goauthentik.io with terraform.
https://registry.terraform.io/providers/goauthentik/authentik/latest/docs
GNU General Public License v3.0
69 stars 18 forks source link

Add RBAC support #538

Closed marcportabellaclotet-mt closed 2 months ago

marcportabellaclotet-mt commented 2 months ago

RBAC is not covered yet by terraform.

It would be a nice to have feature.

marcportabellaclotet-mt commented 2 months ago

Thanks for looking into this.

I did some trial with the terraform provider, and I faced these little issues:

resource "authentik_rbac_permission_role" "global-permission" {

  role       = "xxxx"
  model      = "authentik_rbac.role"
  permission = "authentik_rbac.access_admin_interface"
}

Error:

HTTP Error '400 Bad Request' during request 'POST /api/v3/rbac/permissions/assigned_by_roles/71e19b4e-1743-4d1c-b7fd-fb0b3cb7f602/assign/': "{"non_field_errors":["The fields model, object_pk must be used together."]}"


resource "authentik_rbac_permission_role" "group-permission" {

  role       = "yyyy"
  model      = "authentik_core.group"
  permission = "view_group"
  object_id  = "zzz"
}

Error:

│ Error: invalid API response


I was able to define a list of string changing the tf validation and the rest of code. However I got the above error about invalid APi response, but the permissions were created in authentik.

Roles are created without issues