Okta Policy Creation Using the Terraform Provider
Last Updated:
Overview
When creating multiple Okta policies through Terraform, new policies conflict with pre-existing policies if they share the same priority level. Managing all policies exclusively through Terraform, assigning unique priority values, and using the depends_on meta-argument to enforce creation order resolves this issue.
Applies To
- Okta Identity Engine (OIE)
- Okta Classic Engine
- Okta Terraform Provider
Cause
Pre-existing policies conflict with new policies created through Terraform when the new policies receive the same priority assignment as the existing policies.
Solution
How are policy priority conflicts resolved in Terraform?
Prevent overlap in policy or rule priorities by managing policy creation and modification exclusively in Terraform and defining unique priority values.
- Manage the creation and modification of policies and rules exclusively through Terraform.
- Define unique priority values for every policy or rule, starting with a priority of 1 and incrementing the priority by 1 for each subsequent policy or rule.
- Use the depends_on meta-argument to force Terraform to create and modify resources in the order of priority. Set the resource with a priority of 2 to depend on the resource with a priority of 1, the resource with a priority of 3 to rely on the resource with a priority of 2, and so on.
