Repository navigation
fix(resolve): resolve a group_role's group through the id map - #201
Merged
Merged
Conversation
A ct.groupRole names its group by key. groupIdForRole looked only at ct's state and the declared groups, so once a group leaves both because OpenTofu owns it, every grant on it failed to resolve, even with the group in .ct/ids.<host>.json. Plain group refs already consulted the map. Needed before ct-structure's groups can leave ct's state and config.
…stead of deferring it A pending group_role is finished at apply from ct's state, which a group resolved through the id map is not in. A grant naming a role declared in the same config therefore deferred, let the resource tier write, and then failed with a misleading 'create failed' message. It now fails at plan time with the two-step remedy. Also checks a same-run-declared group before the id map (as resolve() does), names the id map in the not-found error, and states the limit in the handbook.
Member
Author
|
Review (
No end-to-end run: no host's id map holds groups yet, so the path isn't reachable outside tests today. |
This was referenced Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
ct.groupRole({ group: "<key>", role })resolves its group throughgroupIdForRole, which looked only at ct's state and the declared groups. A plaingroupref already falls back to the OpenTofu id map (#181), but a group_role did not. So once groups belong to OpenTofu and leave ct's state and config, every grant on them would fail with "no managed group named …", even with the group in.ct/ids.<host>.json.This blocks the step after tier 1 in the OpenTofu migration: removing the groups from ct while their grants (tier 2) stay in ct.
What
groupIdForRolechecks the id map after state and before the declared/error branches. A group declared in this config still wins (pending ref, bug(permissions): group + its own groupRole in one config can never plan on a fresh host (the domain half of #29) #106), same order asresolve.docs/handbuch/permissions.mdnames the id map as a valid source, re-signed.Checks
lint, typecheck, test (1273 passed, one new), build, docs staleness all green locally.