Skip to content

Make a fresh-clone plan contain only imports - #59

Merged
donbeave merged 1 commit into
mainfrom
fix-fresh-clone-plan
Nov 14, 2026
Merged

donbeave merged 1 commit into
mainfrom
fix-fresh-clone-plan

Conversation

@donbeave

Copy link
Copy Markdown
Contributor

A fresh-clone plan showed 140 to import, 4 to add, 4 to change, 0 to destroy. This PR removes the add and change entries.

Causes and fixes

  1. Missing imports. terminal-components-claude has live rulesets protect-main (24883153) and protect-tags (24883130) with no import blocks, so the plan would create them. Added both blocks to imports.tf.
  2. Rulesets on a private repository. tailrocks-asd-ste100-skills is private, and its rulesets API returns 403 ("Upgrade to GitHub Pro") on the free plan, so the two creations would fail. The module now declares protect-main, protect-tags and tag-creation rulesets only for repositories with visibility = "public". The inventory entry carries a note saying why. Because the rule is based on visibility, any future private repository behaves the same way.
  3. Settings changes on archived repositories. homebrew-velnor-legacy, velnor-actions-fixture-legacy, velnor-apt-legacy and velnor-legacy are archived, and GitHub refuses changes to them. The inventory has a new archived field (default false), set on those four. The module creates github_repository.managed_settings only for non-archived entries. For archived ones it reads the repository through a github_repository data source. This keeps the repository IDs that the velnor-trusted runner group needs, and nothing is written. Their rulesets stay managed and importable, because the plan showed no changes for them. The four settings import blocks and the four settings moved blocks are removed. No repository is unarchived or destroyed.

Affected resources

  • Added imports: protect_main["terminal-components-claude"], protect_tags["terminal-components-claude"].
  • No longer planned: protect_main["tailrocks-asd-ste100-skills"], protect_tags["tailrocks-asd-ste100-skills"] (creates).
  • No longer planned: updates to managed_settings of the four archived repositories (their settings imports are also removed).

Verification

  • tofu fmt -check -recursive and tofu validate pass with the pinned OpenTofu 1.13.1.
  • I could not run a real plan, because it needs the 1Password token. The expected result comes from reasoning over /tmp/tailrocks-tofu-plan.log.

Expected result

The next fresh plan should show only 138 to import, 0 to add, 0 to change, 0 to destroy (140 - 4 archived settings imports + 2 new ruleset imports).

🤖 Generated with Claude Code

Import the terminal-components-claude rulesets, stop declaring rulesets
for private repositories, and skip settings for archived repositories.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
@donbeave
donbeave marked this pull request as ready for review November 14, 2026 21:27
@donbeave
donbeave merged commit b7bb50d into main Nov 14, 2026
6 of 11 checks passed
@donbeave
donbeave deleted the fix-fresh-clone-plan branch November 14, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant