Skip to content

feat: use mutex locks in okta_app_signon_policy_rule#2571

Merged
pranav-okta merged 2 commits into
masterfrom
OKTA-1052616-fix-priority
Nov 25, 2025
Merged

feat: use mutex locks in okta_app_signon_policy_rule#2571
pranav-okta merged 2 commits into
masterfrom
OKTA-1052616-fix-priority

Conversation

@pranav-okta
Copy link
Copy Markdown
Contributor

@pranav-okta pranav-okta commented Nov 20, 2025

This fix mirrors the solution in #1248, which addressed the same issue for okta_auth_server_policy_rule. That PR demonstrated that mutex locking at the resource level effectively prevents API concurrency issues while maintaining correct Terraform state management.

When managing multiple okta_app_signon_policy_rule resources with concurrent operations, the Okta API may encounter concurrency issues. While this provider implements internal locking to prevent conflicts within a single Terraform process, you should use explicit depends_on references between rules to ensure proper sequencing, especially when managing rule priorities.

@pranav-okta pranav-okta self-assigned this Nov 20, 2025
@pranav-okta pranav-okta marked this pull request as draft November 20, 2025 08:02
@pranav-okta pranav-okta force-pushed the OKTA-1052616-fix-priority branch from fab6a90 to dae465b Compare November 24, 2025 05:40
@pranav-okta pranav-okta marked this pull request as ready for review November 24, 2025 05:48
return resourceOIEOnlyFeatureError(resources.OktaIDaaSAppSignOnPolicyRule)
}

oktaMutexKV.Lock(resources.OktaIDaaSAppSignOnPolicyRule)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please record VCR tests for the issue i.e record the test for the configuration that was buggy which your PR fixes.


~> **WARNING:** This feature is only available as a part of the Identity Engine. [Contact support](mailto:dev-inquiries@okta.com) for further information.

~> **WARNING:** When managing multiple `okta_app_signon_policy_rule` resources with concurrent operations, the Okta API may encounter concurrency issues. While this provider implements internal locking to prevent conflicts within a single Terraform process, you should use explicit `depends_on` references between rules to ensure proper sequencing, especially when managing rule priorities.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please include this caveat in the PR's description ?
Just in case they don't see the Files Changed.

dhiwakar-okta
dhiwakar-okta previously approved these changes Nov 24, 2025
Copy link
Copy Markdown
Contributor

@dhiwakar-okta dhiwakar-okta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with comments.

@pranav-okta pranav-okta force-pushed the OKTA-1052616-fix-priority branch from f88e9b8 to fd2a192 Compare November 25, 2025 10:46
Copy link
Copy Markdown
Contributor

@dhiwakar-okta dhiwakar-okta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@pranav-okta pranav-okta merged commit d25141d into master Nov 25, 2025
4 checks passed
andrew951 pushed a commit to andrew951/terraform-provider-okta that referenced this pull request Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants