Míla Votradovec
10/02/2025, 5:46 PMpermit env export terraform --api-key **** but I can't get it running against https://app.eu.permit.io. I guess it might be problem even for permit login
Any help @Ask Inkeep?Ask Inkeep
10/02/2025, 5:46 PMAsk Inkeep
10/02/2025, 5:46 PM<http://api.eu.permit.io|api.eu.permit.io> instead of the default <http://api.permit.io|api.permit.io>. (1)
The CLI commands don't have a built-in flag to specify the API URL directly. However, based on the documentation, here are potential solutions:
For the Node SDK, you can specify the EU endpoint like this:
const permit = new Permit({
// the API key to the Permit environment you wish to connect to
token: "<YOUR_API_KEY>",
// the url in which the SDK can connect to the PDP container
pdp: "<http://localhost:7766>",
// use this to turn on sdk logs
log: {
level: "debug",
},
// the region in which the Permit environment is located
apiUrl: "<https://api.eu.permit.io>",
}) ;
Unfortunately, the CLI documentation doesn't explicitly show how to configure the API URL for EU region when using permit env export terraform or permit login commands. (2) (3) (4) The CLI appears to default to the standard <http://api.permit.io|api.permit.io> endpoint.
You might want to reach out to Permit.io support at Email for guidance on configuring the CLI for EU region, as this specific configuration isn't documented in the available sources.Ask Inkeep
10/02/2025, 5:46 PMMíla Votradovec
10/02/2025, 5:47 PMYou might want to reach out to Permit.io support🆘 🙂
Or Weis
10/02/2025, 6:00 PMMíla Votradovec
10/02/2025, 6:04 PMMíla Votradovec
10/02/2025, 6:05 PMOr Weis
10/02/2025, 6:07 PMOr Weis
10/03/2025, 7:14 AMOr Weis
10/03/2025, 7:21 AMMíla Votradovec
10/03/2025, 7:47 AMnode ./dist/cli.js login --region eu, I immediately get Authorization code not found in query string
Without region, I am correctly prompted to log inOr Weis
10/03/2025, 7:57 AMMíla Votradovec
10/03/2025, 8:01 AMEli Moshkovich
10/03/2025, 7:17 PM<https://api.eu.permit.io/v1/> as the Auth0 audience, but Auth0 only recognizes <https://api.permit.io/v1/> for both regions.
I've just pushed a fix to the PR, The --region eu flag should now work properly 🙂
Please pull the latest changes, rebuild (npm run build), and node ./dist/cli.js login --region eu should work nowMíla Votradovec
10/06/2025, 8:50 AMnpm run build
• node ./dist/cli.js login --region eu
• node ./dist/cli.js env export terraform --api-key ****
I get {"detail":"Invalid credentials"}
I tried selecting different environments, I tried both environments and freshly created Organization API key, but result is still the same.
Could you please have a look into that?Alon Boshi
10/06/2025, 9:03 AMAsk Inkeep
10/06/2025, 9:03 AMAsk Inkeep
10/06/2025, 9:03 AMpermit env export terraform command accepts an --api-key parameter (1) . When you're logged in via permit login --region eu, the CLI should be using the EU endpoint, but it seems the terraform export command might not be respecting the region setting from your login session.
Here's what you can try:
1. *Verify your API key scope*: The terraform export requires a project-level or higher API key . Make sure your API key has the correct permissions.
2. *Check if the region is being applied*: Since you've successfully logged in with --region eu, the issue might be that the terraform export command isn't inheriting the region setting.
The command structure should be:
permit env export terraform --api-key <your-api-key>
Since this appears to be a bug with the new EU region support that's being added via the PR you're testing, I'd recommend adding this feedback directly to the PR discussion. The terraform export command may need to be updated to respect the region setting established during login.
For debugging purposes, could you share:
1. Which Workspace / Project / Env you are using
2. The exact command you're running (with the API key redacted)
3. Whether you're using a project-level or organization-level API key
4. Any error logs from the CLI when running with debug mode enabled
This will help the team investigate the issue with the EU region support in the terraform export command.Ask Inkeep
10/06/2025, 9:03 AMEli Moshkovich
10/06/2025, 5:58 PM--region flag only applies to the login command. When using --api-key directly, you need to set the PERMIT_REGION environment variable manually:
# Build
npm run build
# Set region for your session
export PERMIT_REGION=eu
# Now use commands with your EU API key
node ./dist/cli.js env export terraform --api-key ****
Why this happens:
When you log in with --region eu, the region is stored automatically. But when you use --api-key (which skips login), the CLI needs the region to be explicitly defined via the environment variable.
We’ve also pushed a fix to the PR that includes improvements to EU region handling, please pull the latest changes before testing again.Míla Votradovec
10/08/2025, 10:21 AMpermitio_role except one - admin. No matter what I try, I can't get admin exported to my terraform config. Is this something you could have a look into, please?
tagging @Ask Inkeep in case it would be some known issueAsk Inkeep
10/08/2025, 10:21 AMAsk Inkeep
10/08/2025, 10:21 AMadmin role in your Terraform export could be related to a known issue with the CLI's terraform export functionality (1) . According to the GitHub issue, the Terraform export has been reported to generate incomplete exports - it only generates roles and resource sets but misses the actual permitio_condition_set_rule resources that represent checked permissions in the policy matrix .
The permit env export terraform command exports all environment content including resources, roles, user sets, resource sets, and condition sets in the Permit Terraform provider format (2) (3) . However, if your admin role has specific policy rules or condition set rules associated with it, these might not be getting exported correctly.
Here's what the exported role should look like based on the Terraform provider documentation (4) :
resource "permitio_role" "admin" {
key = "admin"
name = "Administrator"
description = "Full access to documents including deletion"
permissions = ["document:read", "document:write", "document:delete"]
depends_on = [permitio_resource.document]
}
To help troubleshoot this further, you could:
1. Check if the admin role appears correctly in the Permit.io dashboard
2. Try creating a simple test role to see if it exports properly
3. Review if the admin role has any special configurations that might be causing the export to skip it
This appears to be a limitation of the current CLI export functionality rather than an issue with your specific setup.Ask Inkeep
10/08/2025, 10:22 AMMíla Votradovec
10/08/2025, 10:22 AMAsk Inkeep
10/08/2025, 10:22 AMAsk Inkeep
10/08/2025, 10:22 AMadmin role isn't being exported. The Terraform export functionality should export all roles defined in your environment (1) .
Based on the Terraform provider examples, a properly exported admin role should look like this (2) :
resource "permitio_role" "admin" {
key = "admin"
name = "Administrator"
description = "Full access to documents including deletion"
permissions = ["document:read", "document:write", "document:delete"]
depends_on = [permitio_resource.document]
}
The CLI's permit env export terraform command is designed to export all environment content including resources, roles, user sets, resource sets, and condition sets (1) . If the admin role appears correctly in your Permit.io dashboard but isn't being exported, this could be a bug in the export functionality.
To help our engineers investigate this issue with the missing admin role in your Terraform export:
1. Which Workspace / Project / Env are you using?
2. Could you share the exact command you're running (with API key redacted) ?
3. Which version of the CLI are you running (since you're testing the PR branch) ?
4. Could you share any relevant logs from running the export command, perhaps with debug logging enabled?
Additionally, it would be helpful to know:
• Does the admin role have any permissions assigned in the policy matrix?
• Are there any special characters in the role name or key?
• Does the role have any dependencies on resources that might not be exporting?
This information will help determine if this is related to the EU region changes or a separate export issue.Ask Inkeep
10/08/2025, 10:23 AMEli Moshkovich
10/08/2025, 4:46 PMadmin.
If you need to manage admin via terraform, create a custom role with a different name (like super_admin) instead. Custom roles will show up in the export.Eli Moshkovich
10/08/2025, 7:43 PMadmin role should now appear in the exportAlon Boshi
10/13/2025, 6:41 AMMíla Votradovec
10/14/2025, 1:48 PMMíla Votradovec
10/14/2025, 1:51 PMOr Weis
10/14/2025, 1:55 PMOr Weis
10/14/2025, 1:56 PMEli Moshkovich
10/14/2025, 7:08 PMEli Moshkovich
10/15/2025, 4:34 PMMíla Votradovec
11/10/2025, 10:26 AMAlon Boshi
11/10/2025, 10:37 AMMíla Votradovec
11/10/2025, 10:39 AMAlon Boshi
11/10/2025, 10:45 AMMíla Votradovec
11/10/2025, 10:45 AMEli Moshkovich
11/10/2025, 3:58 PMMíla Votradovec
11/14/2025, 5:14 PM│ Error: Unable to create role
│
│ with module.permit_io_config.permitio_role.admin,
│ on ../modules/permit_io_config/permit_config.tf line 196, in resource "permitio_role" "admin":
│ 196: resource "permitio_role" "admin" {
│
│ unable to create role: ErrorCode: Conflict, ErrorType: api_error, Message: The resource already exists
I think it is because of default admin, viewer, editor roles.
Do you know if there is a workaround?Alon Boshi
11/14/2025, 7:41 PMThomas
11/14/2025, 9:04 PM