Add role_assignment resource and admin_role_id to space resource #105
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.
This PR implements the
role_assignment
resource requested in issue #85, along with the preferred solution of addingadmin_role_id
output to the space resource.Changes Made
Admin Role ID Support (Preferred Solution)
Added
admin_role_id
as a computed output field to both thecontentful_space
resource andcontentful_space
data source. When a space is created or read, the provider automatically fetches all roles for the space and identifies the admin role using intelligent heuristics:The admin role detection algorithm identifies roles with:
Role Assignment Resource
Created a complete
contentful_role_assignment
resource structure that supports:Inputs:
space_id
- The space where the assignment is madeteam_id
- Team to assign the role to (from futurecontentful_team
resource)role_id
- Specific role to assign (mutually exclusive withis_admin
)is_admin
- Boolean flag to assign the admin role (mutually exclusive withrole_id
)Validation:
role_id
andis_admin
are mutually exclusiveImport format:
space_id:team_id:role_id
orspace_id:team_id:admin
Current Status
The role assignment resource is implemented as a placeholder since the underlying Contentful Management API endpoints for role assignments are not yet available. The resource currently returns a helpful "Feature Not Available" error message and is ready to be activated when Contentful adds the necessary APIs.
The admin role ID functionality is fully operational and uses the existing
GetAllRoles
API endpoint.Dependencies
Fixes #85.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.