Files
terraform-git/modules/gitea_instance/modules/repository/main.tf
T
unkinben cad35f8d9b
ci/woodpecker/pr/plan Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
repository: stop migration_mirror_interval planning an update every run
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.
2026-08-11 21:14:24 +10:00

26 lines
1.1 KiB
Terraform

resource "gitea_repository" "this" {
username = var.organisation
name = var.name
description = var.description
private = var.private
default_branch = var.default_branch
has_issues = var.has_issues
has_wiki = var.has_wiki
has_pull_requests = var.has_pull_requests
has_projects = var.has_projects
allow_merge_commits = var.allow_merge_commits
allow_rebase = var.allow_rebase
allow_rebase_explicit = var.allow_rebase_explicit
allow_squash_merge = var.allow_squash_merge
archived = var.archived
repo_template = var.repo_template
website = var.website
autodetect_manual_merge = var.autodetect_manual_merge
archive_on_destroy = true
lifecycle {
# migration_mirror_interval defaults to "8h0m0s" but Gitea returns an empty MirrorInterval for non-mirror repos, so the read-back never matches and plans a spurious update every run; it is a migration-only knob with no drift to track here.
ignore_changes = [migration_mirror_interval]
}
}