Repository navigation
Conversation
Signed-off-by: cwahn <cwahn0904@gmail.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (2)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthrough
ChangesTerraform SDK deletion
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to No actionable merge-blocking risk was identified. The change appears ready to merge after normal checks. Security Architecture ReviewSecurity architecture risk: ⚪ Minimal · up to The change narrows deletion to the existing resource instead of allowing pending changes to trigger replacement. Existing resource identity, provider authority, and update protections are preserved. No introduced or worsened security risk was identified. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 6 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (6 passed)
Full details: Template Breaking ChangesExplanation This changes shared SDK controller deletion behavior used by generated providers. The generated controller template wires SDK-backed resources to Resolution Before merging, validate the deletion behavior with multiple generated SDK providers, including a resource with a pending
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description of your changes
Use a fresh destroy-only Terraform Plugin SDK diff when deleting an external resource.
Reusing the observation diff and setting
Destroyretains pendingRequiresNewchanges. The SDK interprets that as replacement and calls Create after Delete. A destroy-only diff preserves existing timeout metadata while deleting from prior state, without mutating the observation/update diff.Fixes #420
I have:
make reviewableto ensure this PR is ready for review.backport release-x.ylabels to auto-backport this PR if necessary.How has this code been tested
Added table-driven regression tests using real
schema.Resource.Applyand Create/Delete callbacks. They cover nil and unchanged diffs, timeout overrides and fallback, pending ordinary updates, and pending ForceNew changes. Each asserts Delete once, Create never, prior-state attributes and identity, cleared tracked state, no panic, and an unchanged observation diff. The ForceNew case also verifies that Update still rejects replacement before any SDK callback.Before the fix, the ForceNew regression failed by invoking Delete followed by Create and mutating the observation diff. After the fix:
go test -mod=readonly ./pkg/controller -run '^TestTerraformPluginSDKDelete' -count=1 -vpassed.go test -mod=readonly ./pkg/controller -count=1passed.go vet -mod=readonly ./pkg/controllerpassed.make reviewablepassed after initializing the pinned build submodule.gofmtandgit diff --checkwere clean.No provider-specific logic, dependency updates, or changes to Update's ForceNew rejection are included.