kanidm (Fix): opencloud-groups manager = idm_admins - the only converging value #176

Merged
ginjiruu merged 2 commits from opencloud-groups-idm-managed into master 2026-11-20 22:40:43 +00:00
Owner

Follows #175. #175 dropped entry_managed_by from config; the apply then failed with a new error: Provider returned invalid result object after apply - members still unknown. Root cause read in the provider source (seanlatimer/kanidm 0.1.10 group_resource.go Update): a null plan value for entry_managed_by yields managedBy=nil which UpdateGroup reads as do-not-touch; with nothing to send the Update takes the skip path and calls resp.State.Set(plan) while members (Optional+Computed, unset in config, no UseStateForUnknown) is still (known after apply) - tofu rejects, every cycle, forever, WITHOUT clearing the live attribute (verified: live group still carries the opencloud-bind oauth UUID after two failed applies). So the provider can only ever SET entry_managed_by to a value that its resolver can fetch - person/service_account/group, not oauth accounts. idm_admins is resolvable, applies with the runner idm_admins-scope token, and expresses exactly the intended end state: the group is admin-managed. Members are untouched by this plan (unchanged from live, resolved as raw spns the API accepts).

Follows #175. #175 dropped entry_managed_by from config; the apply then failed with a new error: Provider returned invalid result object after apply - members still unknown. Root cause read in the provider source (seanlatimer/kanidm 0.1.10 group_resource.go Update): a null plan value for entry_managed_by yields managedBy=nil which UpdateGroup reads as do-not-touch; with nothing to send the Update takes the skip path and calls resp.State.Set(plan) while members (Optional+Computed, unset in config, no UseStateForUnknown) is still (known after apply) - tofu rejects, every cycle, forever, WITHOUT clearing the live attribute (verified: live group still carries the opencloud-bind oauth UUID after two failed applies). So the provider can only ever SET entry_managed_by to a value that its resolver can fetch - person/service_account/group, not oauth accounts. idm_admins is resolvable, applies with the runner idm_admins-scope token, and expresses exactly the intended end state: the group is admin-managed. Members are untouched by this plan (unchanged from live, resolved as raw spns the API accepts).
Collaborator

tf-controller plan output:


OpenTofu used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place (current -> planned)

OpenTofu will perform the following actions:

  # kanidm_group.opencloud_groups will be updated in-place
  ~ resource "kanidm_group" "opencloud_groups" {
      ~ entry_managed_by = "018fa4a0-0d5b-4068-98e0-534e0f00e735" -> "idm_admins"
        id               = "c893a6cf-23b8-4569-942a-986bc20ad81d"
      ~ members          = [
          - "0c020e8a-2da6-415e-8316-7e5e873aae46",
          - "38068641-dba1-43cd-a178-37ecb01825d9",
          - "5fc24424-e6b0-4cef-8e73-e1c4e67f1af2",
          - "d131685d-249c-4adb-9941-600c6c1ddfb4",
          - "opencloud-bind@auth.animeteamspeak.moe",
        ] -> (known after apply)
        name             = "opencloud-groups"
        # (1 unchanged attribute hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

To apply this plan, please merge this pull request.

tf-controller plan output: ```hcl OpenTofu used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place (current -> planned) OpenTofu will perform the following actions: # kanidm_group.opencloud_groups will be updated in-place ~ resource "kanidm_group" "opencloud_groups" { ~ entry_managed_by = "018fa4a0-0d5b-4068-98e0-534e0f00e735" -> "idm_admins" id = "c893a6cf-23b8-4569-942a-986bc20ad81d" ~ members = [ - "0c020e8a-2da6-415e-8316-7e5e873aae46", - "38068641-dba1-43cd-a178-37ecb01825d9", - "5fc24424-e6b0-4cef-8e73-e1c4e67f1af2", - "d131685d-249c-4adb-9941-600c6c1ddfb4", - "opencloud-bind@auth.animeteamspeak.moe", ] -> (known after apply) name = "opencloud-groups" # (1 unchanged attribute hidden) } Plan: 0 to add, 1 to change, 0 to destroy. ``` To apply this plan, please **merge** this pull request.
Collaborator

tf-controller plan output:


OpenTofu used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place (current -> planned)

OpenTofu will perform the following actions:

  # kanidm_group.opencloud_groups will be updated in-place
  ~ resource "kanidm_group" "opencloud_groups" {
      ~ entry_managed_by = "018fa4a0-0d5b-4068-98e0-534e0f00e735" -> "idm_admins"
        id               = "c893a6cf-23b8-4569-942a-986bc20ad81d"
        name             = "opencloud-groups"
        # (2 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

To apply this plan, please merge this pull request.

tf-controller plan output: ```hcl OpenTofu used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place (current -> planned) OpenTofu will perform the following actions: # kanidm_group.opencloud_groups will be updated in-place ~ resource "kanidm_group" "opencloud_groups" { ~ entry_managed_by = "018fa4a0-0d5b-4068-98e0-534e0f00e735" -> "idm_admins" id = "c893a6cf-23b8-4569-942a-986bc20ad81d" name = "opencloud-groups" # (2 unchanged attributes hidden) } Plan: 0 to add, 1 to change, 0 to destroy. ``` To apply this plan, please **merge** this pull request.
Collaborator

tf-controller plan output:


OpenTofu used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place (current -> planned)

OpenTofu will perform the following actions:

  # kanidm_group.opencloud_groups will be updated in-place
  ~ resource "kanidm_group" "opencloud_groups" {
      ~ entry_managed_by = "018fa4a0-0d5b-4068-98e0-534e0f00e735" -> "idm_admins"
        id               = "c893a6cf-23b8-4569-942a-986bc20ad81d"
        name             = "opencloud-groups"
        # (2 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

To apply this plan, please merge this pull request.

tf-controller plan output: ```hcl OpenTofu used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place (current -> planned) OpenTofu will perform the following actions: # kanidm_group.opencloud_groups will be updated in-place ~ resource "kanidm_group" "opencloud_groups" { ~ entry_managed_by = "018fa4a0-0d5b-4068-98e0-534e0f00e735" -> "idm_admins" id = "c893a6cf-23b8-4569-942a-986bc20ad81d" name = "opencloud-groups" # (2 unchanged attributes hidden) } Plan: 0 to add, 1 to change, 0 to destroy. ``` To apply this plan, please **merge** this pull request.
ginjiruu merged commit a3bbd963d6 into master 2026-11-20 22:40:43 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lab/iac!176
No description provided.