repository: stop migration_mirror_interval planning an update every run #65

Merged
benvin merged 1 commits from benvin/branch-protection-whitelist-drift into main 2026-08-11 21:25:28 +10:00
Owner

Why

The go-gitea/gitea provider schema defaults migration_mirror_interval to "8h0m0s", but on read it writes repo.MirrorInterval straight back into state (resource_gitea_repository.go:442), and Gitea returns an empty MirrorInterval for non-mirror repositories.

So the stored value ("") never matches the schema default ("8h0m0s"), and tofu plans an in-place update of every gitea_repository on every run even with no config change — the classic go-gitea provider perpetual diff. migration_mirror_interval is the only migration_* field read back from the API; the rest are write-only migration options, so no sibling field churns.

Change

  • Add a targeted lifecycle { ignore_changes = [migration_mirror_interval] } at the repository module so the provider default no longer fights Gitea's empty value, making every repository idempotent. It is a migration-only knob with no drift to track for these non-mirror repos.
## Why The `go-gitea/gitea` provider schema defaults `migration_mirror_interval` to `"8h0m0s"`, but on read it writes `repo.MirrorInterval` straight back into state (resource_gitea_repository.go:442), and Gitea returns an **empty** `MirrorInterval` for non-mirror repositories. So the stored value (`""`) never matches the schema default (`"8h0m0s"`), and `tofu` plans an in-place update of **every** `gitea_repository` on every run even with no config change — the classic go-gitea provider perpetual diff. `migration_mirror_interval` is the only `migration_*` field read back from the API; the rest are write-only migration options, so no sibling field churns. ## Change - Add a targeted `lifecycle { ignore_changes = [migration_mirror_interval] }` at the repository module so the provider default no longer fights Gitea's empty value, making every repository idempotent. It is a migration-only knob with no drift to track for these non-mirror repos.
unkinben added 1 commit 2026-08-11 21:14:25 +10:00
repository: stop migration_mirror_interval planning an update every run
ci/woodpecker/pr/plan Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
cad35f8d9b
Why:
- The go-gitea/gitea provider schema defaults migration_mirror_interval to
  "8h0m0s", but on read it writes repo.MirrorInterval straight back into state,
  and Gitea returns an empty MirrorInterval for non-mirror repositories.
- So the stored value ("") never matches the schema default ("8h0m0s"), and tofu
  plans an in-place update of every gitea_repository on every run even with no
  config change, keeping terraform-git plans perpetually dirty.
- migration_mirror_interval is the only migration_* field read back from the API;
  the rest are write-only migration options, so no sibling field churns.

Change:
- Add a targeted ignore_changes on migration_mirror_interval at the repository
  module so the provider default no longer fights Gitea's empty value, making
  every repository idempotent. It is a migration-only knob with no drift to track
  for these non-mirror repos.
unkinben force-pushed benvin/branch-protection-whitelist-drift from 6bb636846f to cad35f8d9b 2026-08-11 21:14:25 +10:00 Compare
unkinben changed title from branch_protection: stop whitelist representation churn planning every run to repository: stop migration_mirror_interval planning an update every run 2026-08-11 21:14:44 +10:00
benvin merged commit dcf30f3036 into main 2026-08-11 21:25:28 +10:00
benvin deleted branch benvin/branch-protection-whitelist-drift 2026-08-11 21:25:29 +10:00
Sign in to join this conversation.