fix: resolve 409 conflict error when deleting actions bound to triggers #1335 #1336
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix: resolve 409 conflict error when deleting actions bound to triggers
Fixes #1335
🔧 Changes
This PR resolves the 409 Conflict error that occurs when deleting actions bound to triggers, particularly when using conditional resources with
count
orfor_each
.Key Changes:
deleteAction()
function: Added automatic unbinding logic that removes actions from all trigger bindings before deletionIsStatusError()
to detect 409 conflicts and retry with exponential backoffsupportedTriggers
array used across all action resources (auth0_action
,auth0_trigger_actions
,auth0_trigger_action
)Files Modified:
internal/auth0/action/resource.go
- Main fix with auto-unbinding logicinternal/auth0/action/resource_trigger_actions.go
- Updated to use shared constantsinternal/auth0/action/resource_trigger_action.go
- Updated to use shared constantsinternal/error/api_error.go
- EnhancedIsStatusError()
function for better error detection📚 References
🔬 Testing
Manual Testing Performed:
TestAccAction
test suite (passes in 96.22s)Test Scenario:
Before Fix:
terraform apply -var="feature_toggle_enabled=false"
would hang indefinitely with a 409 errorAfter Fix:
Operation now completes successfully with automatic unbinding
📝 Checklist