<@U08614ZV82F> Can the permit PDP use an org-level...
# permit-saas
a
@Ask Inkeep Can the permit PDP use an org-level API key?
a
Thanks for tagging me @Aden McCusker. I'll look through relevant sources and get back to you shortly.
No, the PDP cannot use an organization-level API key. The
PDP_API_KEY
configuration requires an ​*Environment-level API Key*​ specifically. (1) There are three types of API keys in Permit.io: (2) • ​*Organization API Keys*​ – Can act on your entire Permit workspace and access all projects and environments within that workspace. • ​*Project API Keys*​ – Can access a single project and all environments belonging to that project. • ​*Environment API Keys*​ – Can access a single environment. ​*Only this type of API key can be used by the PDP container.*​ So when configuring your PDP with
PDP_API_KEY
, you must use an Environment-level key obtained from your specific environment. (1)
To learn more, see the sources I considered: [[1] Configurations](https://docs.permit.io/concepts/pdp/configuration) [[2] Using the API](https://docs.permit.io/api/api-with-cli)
o
It can't, and really shouldn't. If you need a PDP with information from multiple environments, we encourage you to create this merged env explicitly using CI/ CD techniques, our copy api, and better yet the Terraform provider @Ask Inkeep
a
Thanks for tagging me @Or Weis. I'll look through relevant sources and get back to you shortly.
Great additional context! To expand on this for @Aden McCusker: If you need to consolidate policies from multiple environments into a single PDP, the recommended approaches are: (1) (2) ​*CI/CD with the Environment API:*​ • Use the
create-env
API to dynamically create preview environments for deployment as part of your CI/CD pipeline (1) • Use the
copy-env
API to merge/promote changes between environments (1) (2) ​*Terraform Provider:*​ • The Permit Terraform Provider allows you to manage policy schemas as code, integrating policy management directly into your SDLC (3) • You can version policies, manage branches, and integrate them seamlessly with your CI/CD pipeline ​*GitOps:*​ • Integration with Git allows merging and enforcing policy changes by managing authorization policies just as you would manage code (1) • Behind the scenes, Permit creates a Policy as Code repository for each project, and environments are branches in this repository (4) This approach ensures each PDP is correctly siloed to its intended environment using its unique secret key, while still allowing you to explicitly manage how policies flow between environments. (1)
To learn more, see the sources I considered: [[1] Permit.io Best Practices](https://docs.permit.io/overview/best-practices) [[2] Manage Policy Life Cycle - CI/CD](https://docs.permit.io/how-to/SDLC/CI-CD) [[3] Permit.io Launch Week - Day 3: Fine-Grained Modeling](https://www.permit.io/blog/launch-week-3-fine-grained-modeling) [[4] Modeling and Implementation Components](https://docs.permit.io/how-to/SDLC/modeling-implementation-components)
o
consider using tenats + role attributes, and/or ReBAC group to build silos within the merged environment
✅ 1