Fix local pool: lifecycle ignore_changes to prevent destroy #44

Merged
AlexCaswen merged 5 commits from 46-import-local-pool into main 2026-05-09 17:33:17 +00:00
AlexCaswen commented 2026-05-09 17:31:14 +00:00 (Migrated from gitlab.com)

What

Third attempt at #46. The pool was successfully imported into state by !42 but OpenTofu keeps trying to destroy/recreate it because config fields on storage pools trigger force-replacement.

Root Cause

The incus_storage_pool resource treats changes to source and zfs.pool_name as force-replacement fields. Even with the correct values declared (!43), the state was imported with bare config, so OpenTofu sees a diff and plans replacement.

Fix

  • Removed the import block (pool is already in state)
  • Added lifecycle { ignore_changes = all } — since IncusOS owns pool config (encryption, ZFS settings), Terraform should never attempt to modify it
  • Pool remains tracked in state for reference by other resources

Expected behavior

tofu plan produces no changes for incus_storage_pool.local. The pool stays in state, containers can reference it, and IncusOS retains full ownership of its config.

Closes #46

## What Third attempt at #46. The pool was successfully imported into state by !42 but OpenTofu keeps trying to destroy/recreate it because config fields on storage pools trigger force-replacement. ## Root Cause The `incus_storage_pool` resource treats changes to `source` and `zfs.pool_name` as force-replacement fields. Even with the correct values declared (!43), the state was imported with bare config, so OpenTofu sees a diff and plans replacement. ## Fix - Removed the `import` block (pool is already in state) - Added `lifecycle { ignore_changes = all }` — since IncusOS owns pool config (encryption, ZFS settings), Terraform should never attempt to modify it - Pool remains tracked in state for reference by other resources ## Expected behavior `tofu plan` produces no changes for `incus_storage_pool.local`. The pool stays in state, containers can reference it, and IncusOS retains full ownership of its config. Closes #46
AlexCaswen (Migrated from gitlab.com) approved these changes 2026-05-09 17:31:14 +00:00
AlexCaswen commented 2026-05-09 17:32:32 +00:00 (Migrated from gitlab.com)

added 3 commits

  • 035a949f...0398d05e - 2 commits from branch main
  • 200789c9 - Merge branch 'main' into '46-import-local-pool'

Compare with previous version

added 3 commits <ul><li>035a949f...0398d05e - 2 commits from branch <code>main</code></li><li>200789c9 - Merge branch &#39;main&#39; into &#39;46-import-local-pool&#39;</li></ul> [Compare with previous version](/AlexCaswen/m3-infra/-/merge_requests/44/diffs?diff_id=1791406525&start_sha=035a949ff445259b1a681c8518617a45f32730f0)
AlexCaswen commented 2026-05-09 17:32:57 +00:00 (Migrated from gitlab.com)

approved this merge request

approved this merge request
AlexCaswen (Migrated from gitlab.com) scheduled this pull request to auto merge when all checks succeed 2026-05-09 17:33:03 +00:00
AlexCaswen (Migrated from gitlab.com) merged commit cde30ef87f into main 2026-05-09 17:33:18 +00:00
AlexCaswen commented 2026-05-09 17:35:08 +00:00 (Migrated from gitlab.com)

mentioned in commit cde30ef87f

mentioned in commit cde30ef87f88f04baa6f7ea73df1e15849885d6c
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
midwitmoneymgmt/m3-infra!44
No description provided.