Ignore rke_config.etcd_snapshot_create to prevent plan drift#221
Ignore rke_config.etcd_snapshot_create to prevent plan drift#221Akini98 wants to merge 1 commit into
Conversation
On-demand etcd snapshots taken via the Rancher UI/API set etcd_snapshot_create.generation on the cluster object. The module does not manage that field, so every subsequent plan showed spurious in-place drift trying to null it. Add it to ignore_changes; scheduled snapshots remain Terraform-managed via etcd_s3. Non-breaking (additive to ignore_changes).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis change updates the ChangesTerraform Drift Fix
Estimated code review effort: 1 (Trivial) | ~3 minutes Related Issues: Suggested Labels: bug, terraform Suggested Reviewers: (none identified) Poem 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Purpose
Resolves #220. On-demand etcd snapshots taken via the Rancher UI/API ("Snapshot Now") set
rke_config.etcd_snapshot_create.generationon the provisioning cluster object. Thek8s-clustermodule does not manage that field, so every subsequentterraform planshows spurious in-place drift trying to null it (e.g.etcd_snapshot_create { generation = 1 -> null }).Goals
Stop the drift while keeping scheduled snapshots Terraform-managed.
Approach
Add
rke_config[0].etcd_snapshot_createto the cluster resource's existinglifecycle { ignore_changes = [...] }(alongsidechart_values/machine_selector_config). On-demand snapshots stay a UI/API action; the schedule remains managed via theetcd_s3input.Release note
Fix:
k8s-clusterno longer shows plan drift after an on-demand etcd snapshot is taken from the Rancher UI.Documentation
The behavior is noted in the backups guide (#219,
examples/BACKUPS.md§A.6).Automation tests
N/A. Observed and reproduced on a live cluster: after a UI "Snapshot Now",
terraform planrepeatedly proposed nullingetcd_snapshot_create; with this change the plan is clean.terraform fmt -checkpasses on the changed file.Security checks
ignore_changesaddition, no values.Compatibility
Non-breaking — additive to
ignore_changes, no variable/output surface change.Related PRs
Other template sections (Training, Certification, Marketing, Migrations, Samples): N/A.
Summary by CodeRabbit