fix: status field miss causing drift suppression - #1705
Draft
KartikJha wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🔧 Changes
Fixes a silent no-drift bug where an
auth0_actionthat failed to build wouldappear healthy on subsequent
terraform planruns, making Terraform-drivenrecovery impossible.
Root cause:
statuswas not tracked in theauth0_actionschema.readAction()discarded it, so Terraform saw no diff after a failed build — planalways reported "No changes."
Fix:
statusas aComputedattribute onauth0_action(resource.go).flattenAction()now stores the value returned by the API (flatten.go).CustomizeDiffhook forces replacement whenstatus == "failed"anddeploy == true:d.SetNewComputed("status")creates the required diff entry (bared.ForceNewerrors without it on a Computed-only attribute).d.ForceNew("status")marks the resource for replacement.deploy == truegate prevents non-deployed draft actions from looping inendless replace cycles.
After the fix, the next
terraform planagainst a failed action shows:~ resource "auth0_action" "example" {
~ status = "failed" -> (known after apply) # forces replacement
}
and the next
terraform applyre-triggers the build automatically.No state migration needed. On first plan after provider upgrade, healthy
actions show
+ status = "built"(cosmetic); failed actions immediately show thereplacement plan.
🔬 Testing
Reproduced and verified against live tenant
kartik-esd-57610.sus.auth0.comusinga 3-stage repro script (
esd_65986_status_no_drift_repro/):terraform apply -var dep_mode=good→ both actions reachstatus="built"terraform apply -var dep_mode=bad→ UPDATE path, build fails, no SDKv2 taint,status="failed"on backendterraform plan -var dep_mode=bad:status = "failed" -> (known after apply) # forces replacement— fix confirmed📝 Checklist