Migrating from access policies to Spacesยป
Access policy deprecation
Access policies are deprecated and will be entirely disabled on May 30, 2026. All access control must be migrated to Spaces and login policies before this date.
This guide helps you migrate from stack-level access policies to space-based RBAC. While Spaces provide a more scalable and maintainable approach to access control, some advanced access policy patterns require adaptation.
Understanding the architectural shiftยป
Access policies and Spaces represent fundamentally different approaches to access control:
| Aspect | Access Policies (Deprecated) | Spaces (Current) |
|---|---|---|
| Granularity | Stack/module level | Space level |
| Evaluation | Per-request (dynamic) | At login (session-based) |
| Control mechanism | OPA/Rego policies attached to stacks | RBAC roles assigned to spaces |
| Flexibility | Highly dynamic (time, IP, state) | Organizational structure |
| Scalability | Can become complex with many stacks | Designed for large organizations |
Why the change?
Access policies worked well for small teams but became difficult to manage at scale. Spaces provide:
- Clear organizational structure aligned with your teams
- Consistent RBAC across all Spacelift resources
- Better performance and auditability
- Simplified permission management through space inheritance
Migration strategy overviewยป
The migration process typically follows these steps:
- Audit existing access policies - Identify all access policies and their rules
- Design space structure - Plan spaces that reflect your organizational boundaries
- Map policies to spaces - Determine which access patterns map to spaces vs login policies
- Implement space structure - Create spaces and move stacks
- Configure access control - Set up login policies or user management
- Test and validate - Verify all users have appropriate access
- Remove access policies - Clean up deprecated policies
Common migration patternsยป
Team-based accessยป
The most common access policy pattern maps directly to Spaces.
Before: Access policyยป
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
1 2 3 4 5 6 7 | |
After: Spaces + login policyยป
Using IdP group mappings
For simpler setups, you can use the user management UI to map IdP groups directly to space roles without writing login policies.
Step 1: Create appropriate spaces
1 2 3 4 5 | |
Step 2: Move stacks to the engineering space
1 2 3 4 5 | |
Step 3: Configure access via login policy
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Environment separationยป
Separating access by environment (dev/staging/prod) is a core Spaces use case.
Before: Access policy with labelsยป
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
After: Environment-based spacesยป
Step 1: Create environment spaces
1 2 3 4 5 6 7 8 9 10 11 | |
Step 2: Move stacks to appropriate spaces based on environment
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Step 3: Configure differentiated access
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
Reducing duplication with helper rules
Use Rego helper functions to reduce duplication when assigning the same role across multiple spaces:
1 2 3 4 5 6 7 | |
1 2 3 4 5 6 | |
Repository-based accessยป
Teams often organize infrastructure by repository, with each team owning specific repos.
Before: Access policyยป
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
1 2 3 4 5 6 7 8 9 10 11 | |
After: Team-based spacesยป
Create one space per team and move their stacks:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
Login policy:
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
1 2 3 4 5 6 7 8 9 10 11 | |
Patterns requiring adaptationยป
Some access policy patterns don't map directly to Spaces and require alternative approaches.
Time-based access controlยป
Access policies could enforce time-of-day restrictions per request. Spaces evaluate access at login time only.
Before: Access policyยป
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
After: Login policy with time checksยป
Evaluation timing difference
Login policies evaluate when users log in, not per-request. Users who log in during business hours will maintain access until their session expires, even outside business hours.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
Mitigation strategies:
- Use approval policies: Add approval requirements that can evaluate time per-run
- Team expectations: Communicate that time restrictions apply at login, not continuously
IP-based access controlยป
Similar to time-based restrictions, IP checks in access policies were per-request. Login policies check IP at login time only.
Before: Access policyยป
1 2 3 4 5 6 7 8 9 10 11 | |
1 2 3 4 5 6 7 8 | |
After: Login policy with IP checksยป
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Mitigation strategies:
- VPN requirements: Require VPN for production access at the network level
- Shorter sessions: Reduce session timeout to re-check IP more frequently
- API key restrictions: For programmatic access, use IP-restricted API keys
Fine-grained access within the same repositoryยป
Access policies could provide different access levels to stacks from the same repository. With Spaces, stacks in the same space have the same access control.
Before: Access policyยป
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
After: Separate spaces per branch/environmentยป
Architectural change required
You cannot provide different access levels to stacks within the same space. You must separate stacks into different spaces based on their access requirements.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
Login policy:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Best practices:
- Use space inheritance to share worker pools and contexts
- Align space boundaries with permission boundaries
- Consider using a parent space for shared resources
Complex conditional logicยป
Access policies could deny access based on runtime stack properties. This is not possible with Spaces.
No direct replacementยป
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Alternative: Use approval policiesยป
For runtime checks, move the logic to approval policies which evaluate when runs are triggered:
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
1 2 3 4 5 6 7 8 9 10 11 | |
Stack locking is built-in
Stack locking is a built-in feature controlled by the stack:unlock-force permission. Only users with this permission (or the lock owner) can unlock stacks, so no custom policy is needed.
Step-by-step migration guideยป
Step 1: Audit current access policiesยป
First, identify all access policies in your account:
Using GraphQL API:
1 2 3 4 5 6 7 8 9 10 | |
Using Terraform:
Search your Terraform code for spacelift_policy resources with type = "ACCESS".
Document each policy:
- What stacks/modules is it attached to?
- What teams/users does it grant access to?
- What conditions does it check (time, IP, labels, etc.)?
- What access level does it grant (read/write)?
Step 2: Design your space structureยป
Plan spaces based on:
- Team boundaries: Who needs access to what?
- Environment separation: Dev, staging, production
- Organizational structure: Business units, projects, products
Space design best practices
See structuring your spaces tree for detailed guidance.
Example structure:
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Step 3: Create spacesยป
Create spaces using Terraform or the web UI:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
Step 4: Migrate stacks to spacesยป
Update each stack to use the appropriate space:
1 2 3 4 5 | |
Plan before applying
Moving stacks between spaces may affect who can see and access them. Test with non-critical stacks first.
Step 5: Configure access controlยป
Choose your access control method:
Option A: Login policies (recommended for complex logic)ยป
Create or update login policies in the root space:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |
Option B: User management UI (recommended for simple setups)ยป
- Go to Organization Settings โ Identity Management โ IdP group mapping
- Map each IdP group to roles in specific spaces
- See assigning roles to groups for details
Step 6: Test accessยป
Before removing access policies:
- Test with non-admin users: Log in as different team members and verify they can access appropriate spaces
- Verify read/write permissions: Ensure users can perform expected actions (trigger runs, modify environment variables)
- Check edge cases: Test any special conditions (time-based, IP-based, etc.)
- Review audit logs: Use audit trail to verify access is working correctly
Step 7: Remove access policiesยป
Once access is verified:
- Detach access policies from stacks/modules
- Delete access policies (keep backups if needed)
- Update documentation to reflect the new access control model
1 2 3 | |
Using custom roles for granular permissionsยป
Instead of built-in Space Reader/Writer/Admin roles, create custom roles with specific permissions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
See custom roles for more details.
Module access migrationยป
Module access policies work the same way as stack access policies:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
Troubleshootingยป
Users can't see spaces after loginยป
Problem: Users log in successfully but see "No spaces available"
Solution:
- Check login policy grants appropriate roles
- Verify users belong to expected IdP teams/groups
- Have users log out and back in (roles evaluated at login time)
- Check space assignments in Organization Settings โ Users
Users lost access after migrationยป
Problem: Users who had access via access policies can no longer access stacks
Solution:
- Verify stacks moved to correct spaces
- Check login policy or user management assigns roles to those spaces
- Confirm user's IdP team membership hasn't changed
- Review audit trail to see what roles user has
Time/IP restrictions not working as expectedยป
Problem: Users can perform actions outside business hours or from wrong locations
Explanation: Login policies evaluate at login time, not per-request
Solution:
- Reduce session timeout to force more frequent re-authentication
- Add approval policies for additional runtime checks
- Use network-level controls (VPN, firewalls) for IP restrictions
- Set clear team expectations about when policies are evaluated
Different access needed for stacks in same spaceยป
Problem: Need write access to some stacks but read-only to others in the same space
Solution: You cannot do this with Spaces. Split stacks into different spaces based on access requirements, or use custom roles with approval policies that check stack properties.
Migration breaking Terraform stateยป
Problem: Moving stacks between spaces causes Terraform drift
Solution:
- Import new space assignments:
terraform import spacelift_stack.example stack-id - Plan carefully before applying to see what will change
- Consider migrating in phases (non-critical stacks first)
Migration checklistยป
Use this checklist to track your migration progress:
- Audit phase
- List all access policies
- Document access patterns for each policy
- Identify policies that need adaptation
- Design phase
- Design space structure
- Map stacks to spaces
- Plan login policy or user management approach
- Implementation phase
- Create spaces in Terraform/UI
- Move stacks to appropriate spaces
- Configure login policies or IdP mappings
- Create custom roles if needed
- Testing phase
- Test with multiple user accounts
- Verify read/write permissions
- Test edge cases (time, IP, etc.)
- Review audit logs
- Cleanup phase
- Detach access policies
- Delete access policies
- Update team documentation
- Communicate changes to users
Related resourcesยป
- Spaces overview: Understanding Spacelift spaces
- Space access control: How RBAC works with spaces
- Login policies: Programmatic access control
- User management: GUI-based permission management
- RBAC system: Understanding roles and permissions
- Custom roles: Creating fine-grained permissions
- Structuring spaces: Best practices for space design
- Stack access policy reference: Original access policy documentation