Summary
Refactor resources to use the lifecycle field enabled instead of count conditionals, and introduce moved blocks to perform automatic state migrations. This will simplify resource logic, improve readability, and ensure compatibility with upcoming lifecycle and ephemeral-resource changes.
Background
Several resources currently rely on count = condition ? 1 : 0 as an enable/disable mechanism. With newer OpenTofu lifecycle capabilities, the preferred approach is the enabled lifecycle meta-argument, which cleanly expresses conditional creation without altering resource indexing.
Since switching from count to enabled changes the resource address, we must provide a moved block to migrate existing state seamlessly. This prevents accidental destruction and re-creation of resources during rollout.