Open plans as Terraform pull requests
A GitHub token and a review rule, so plans arrive as pull requests in your repository.
On this page
Before you begin
- Admin access to the GitHub repository that holds your Okta Terraform.
- An EntiPath owner or admin account.
- Okta connected to EntiPath, and Okta’s group rules managed in Terraform.
It takes about 10 minutes.
If Okta’s group rules are managed with Terraform, EntiPath sends rule plans to your repository as pull requests, with the proof of what each does to people in the description. Your pipeline applies them; EntiPath never runs Terraform.
What EntiPath can edit
EntiPath finds group rules written either way, and edits only their expression and their excluded people:
okta_group_ruleresources in .tf files, withnameandexpression_valuewritten as plain strings.- Entries in a JSON file the Terraform reads, each with a string
nameandexpression_value.
It can’t edit an expression built from variables, locals, heredocs or interpolation, a rule defined in more than one file, or two rules with the same name. Excluding people adds their Okta user ids to users_excluded, which must be a plain list.
Create a GitHub token
In GitHub
- Open a new fine-grained personal access token.
- Set Resource owner to whoever owns the repository.
- Under Repository access, choose Only select repositories and pick the repository.
- Under Repository permissions, set these:
Permission Access What EntiPath does with it Contents Read and write Reads your .tf files and commits each plan on a new branch Pull requests Read and write Opens the pull request and shows its reviews on the plan Administration Read-only Checks the review rule from part 2; it can’t change it ContentsRead and writeReads your .tf files and commits each plan on a new branchPull requestsRead and writeOpens the pull request and shows its reviews on the planAdministrationRead-onlyChecks the review rule from part 2; it can’t change it - Create the token, and copy it when GitHub shows it.
Require reviews on the base branch
In GitHub, in the repository’s settings
EntiPath only opens pull requests that nobody can merge without an independent review.
- Open Settings › Rules › Rulesets.
- Click New ruleset › New branch ruleset.
- Set these:
Setting Set it to Enforcement status Active Bypass list Empty, so nobody skips the review, admins included Target branches Add target › Include default branch, or your base branch Require a pull request before merging On, with Required approvals set to 1 or more Dismiss stale pull request approvals when new commits are pushed On Enforcement statusActiveBypass listEmpty, so nobody skips the review, admins includedTarget branchesAdd target › Include default branch, or your base branchRequire a pull request before mergingOn, with Required approvals set to 1 or moreDismiss stale pull request approvals when new commits are pushedOn - Click Create.
Connect the repository in EntiPath
In EntiPath
- Open Integrations, then your Okta org.
- Open the Applying plans tab.
- Under As Terraform pull requests, fill in:
Field Enter Owner The owner from the repository’s address, github.com/owner/repository Repository The repository’s name from the same address Base branch The branch from part 2 Folder Where the Okta .tf files and any JSON they read are. Empty for the whole repository. GitHub token The token from part 1 OwnerThe owner from the repository’s address, github.com/owner/repositoryRepositoryThe repository’s name from the same addressBase branchThe branch from part 2FolderWhere the Okta .tf files and any JSON they read are. Empty for the whole repository.GitHub tokenThe token from part 1 - Click Check and save.The card says GitHub reviews verified, how many group rules it found, and how many have a plain name and expression EntiPath can edit.

What happens with each plan
In EntiPath and GitHub
- Someone sends a plan to GitHub. On a paid plan, a draft can go straight there with Send to GitHub; during the trial, and for plans that approval rules cover, it’s approved in EntiPath first. EntiPath checks the review rule again before writing anything.
- The pull request is opened as the token’s owner, so someone else approves it: GitHub doesn’t let anyone approve their own.
- Merging it is the approval, and your pipeline applies it to Okta. The plan shows Merged.
- The next Okta sync (scheduled, or Sync now) confirms Okta matches the plan, and the plan shows Done, or Okta differs if it doesn’t.
Withdrawing or undoing a plan
- Closing the pull request without merging withdraws the plan.
- Withdraw on the plan comments on the pull request, closes it and deletes its branch. Once merged, it can’t be withdrawn.
- To undo a merged plan, revert the pull request in GitHub; the plan links to it. There’s no Undo in Okta for Terraform plans.
Changing or removing it
Change
Change edits the repository, branch or folder. Paste the token again to save, which is also how you replace an expiring token.
Remove
Remove deletes the stored token. Pull requests already open stay open in GitHub: close them there, and revoke the token in GitHub too.
Troubleshooting
Find the message EntiPath showed. Each one says why it happens and how to fix it.
“The GitHub token can’t read main’s branch protection (GitHub answered 403)”
The token is missing Administration: Read-only, so EntiPath can’t see the branch’s protection.
- In GitHub, edit the token and add Administration: Read-only, as in part 1. It keeps its value, so there’s nothing to paste again.
- Click Check again.
- If the message also says no ruleset requires reviews, add the ruleset in part 2 as well.
“main has no protection that requires reviews”
Nothing on the branch requires a review yet.
- Add the ruleset in part 2.
- Click Check again.
“No ruleset requires pull request reviews on main” or “main has no branch protection rule”
No ruleset requires pull request reviews on the base branch.
- Add the ruleset in part 2, and check it targets the base branch you set.
- Click Check again.
“… has bypass actors …” or “… has bypass allowances …”
Someone can skip the review.
- For a ruleset, empty its Bypass list.
- For a branch protection rule, tick Do not allow bypassing the above settings and remove anyone allowed to bypass pull requests.
- Click Check again.
“Review rulesets must require at least one approval …”
A review ruleset must require at least one approval and dismiss stale approvals, with nobody able to bypass it.
- In the ruleset, set Required approvals to 1 or more.
- Tick Dismiss stale pull request approvals when new commits are pushed.
“Classic branch protection must require approvals …”
A branch protection rule must require approvals, dismiss stale approvals, and apply to administrators too.
- Turn on Require approvals, with 1 or more.
- Tick Dismiss stale pull request approvals and Do not allow bypassing the above settings.
- Or use a ruleset, as in part 2, instead.
“… could not be read” or “… could not be verified with this token”
EntiPath couldn’t read part of the rules, often a ruleset set on the organization rather than the repository.
- Check the token has Administration: Read-only on this repository.
- Click Check again.
“Verify the repository’s mandatory GitHub review policy …”
The review check hasn’t passed, so EntiPath won’t write to the repository.
- Open the integration’s Applying plans tab.
- Fix what the check says.
- Click Check again.
“The token can read the repository but not push to it”
The token can read the repository but not push to it.
- Give the token Contents and Pull requests Read and write, as in part 1.
“… failed (401): the token is invalid or expired”
The token is wrong or has expired.
- Create a new one, as in part 1.
- Click Change under As Terraform pull requests and paste it.
“… failed (403 or 404): the token cannot see this repository …”
GitHub couldn’t find the repository or branch for this token.
- Check the token’s Repository access includes the repository, and its permissions match part 1.
- Check the Owner, Repository and Base branch are spelled exactly as in GitHub.
“Use the GitHub owner or repository name”
Owner and Repository take just the names from the address, such as acme and okta-terraform, not the whole URL.
- Enter only the names, then save again.
“No group rules found in …”
EntiPath found no rules it recognises in the folder you set (see What EntiPath can edit).
- Check the folder. Plans can still open pull requests once rules are managed there.
“No group rule named … with a plain expression was found” or “… cannot be edited”
The rule exists, but not in a form EntiPath can edit: its expression is built from variables, locals or interpolation, or it changed in the repository after the plan was made.
- Write the expression as a plain string, or make the change by hand.
- Check the plan again.
“… is defined in N places …”
The same rule name appears in more than one file.
- Set the integration’s Folder to the one your Terraform applies.
“users_excluded … is not a plain list”
EntiPath adds excluded people to users_excluded, so it must be a plain list of ids, not built from a variable.
- Write
users_excludedas a list, or exclude the people by hand.
You can’t approve the pull request in GitHub
The pull request was opened as the token’s owner, and GitHub doesn’t let anyone approve their own.
- Ask anyone else with write access to the repository to approve it.
Still stuck? Email support@entipath.com with your workspace address and the message EntiPath showed.