Repository navigation
Description
Update 2026-11-26 (infra move): No OpenTofu stack declares these settings (ADR 0035).
Here: add the rows for the Pages site, the github-pages environment and the collaborators to devops repos onboard. In dan-petty/infra: the Pages and collaborator keys of the schema, and the devops-cli settings of the template (follow-up). tf/github/ and tf/modules/repository are not paths of this repository.
Follow-up: dan-petty/infra#175.
Problem or Motivation
devops-cli settings exist only in GitHub, so a transfer has no baseline to compare with.
Order 10 of the plan in #5311. The owner approved the plan on 2026-11-13.
Proposed Solution & Architectural Design
Add the module tf/github/modules/repository and repos.yaml with devops-cli. Add import blocks with for_each, the release and github-pages environments and the environment variable, Pages, Actions and workflow permissions, security_and_analysis and the full collaborator set. Add postconditions on data sources for the 'main' ruleset rule types, the environment secret names and the App installations. Start from a draft by -generate-config-out.
Target Subsystem
OpenTofu / Infrastructure as Code
Existing Tool Considered
OpenTofu 1.13.9 (MPL-2.0) with integrations/github 6.13.0 (MIT), exact pins, a lock file and Renovate bumps.
Cost: Build: devops-cli stack and module about 1.5M tokens and 2 days; org stack about 0.8M tokens and 1 day. Keep: about 100k tokens a month. Fix: about 300k tokens for each provider regression. Owner: about 30 min for each import apply. This item is the devops-cli stack and the module: about 1.5M tokens and 2 days.
Acceptance Criteria
- The PR body shows a plan from the owner token and a plan from the reader App: imports only, and 0 to add, change or destroy.
- The owner applies the import plan, and nothing changes on GitHub.
Dependencies
#5317, #5318, #5319 and dan-petty/homelab#358; owner decision 4 in #5311. Part of #5311.
Source: #5311
Alternatives check of 2026-11-22: covers.
Tool: integrations/terraform-provider-github (https://github.com/integrations/terraform-provider-github), MIT, last activity 2026-11-19, maintained.
Reason: Searches found the OpenTofu GitHub provider and a settings-file App; the provider already manages repository settings, environments, permissions and collaborators and supports import, so it covers the need and is already in use.
Covers:
- Repository settings, Pages, Actions and workflow permissions
- release and github-pages environments with variables
- security_and_analysis, collaborator set and rulesets
- Import of existing resources through OpenTofu import blocks
Lacks:
- for_each import blocks and -generate-config-out come from OpenTofu, not the provider
- No data-source postconditions; HCL assertions must be written
- main ruleset stays unmanaged while upstream defect fix(roadmap): the jobs trust the items of the two bots #3664 is open
Proposed design
Problem statement
This item was to declare the devops-cli repository in an OpenTofu stack and import its live settings, so that a transfer has a baseline. ADR 0035 (accepted 2026-11-22) amends decisions 1, 4 and 7 of ADR 0026: devops repos onboard owns the repository settings and applies one baseline, the Copier template of dan-petty/infra at a release tag, and OpenTofu keeps only the organization postconditions and the transfer check. The command's rows do not yet cover three settings that this issue names: the Pages site, the github-pages environment and the collaborator set. This item adds those rows and the baseline keys, then records dan-petty/devops-cli in the baseline and proves that its live settings match it, so the transfer has a baseline to compare with.
Acceptance criteria
Requirement: Pages row
devops repos onboard SHALL read the Pages site settings from the baseline github/repository.yaml and write only the keys that differ.
Scenario: Plan a Pages difference
- WHEN The test
tests/github/onboard/test_onboard_pages.py::test_pages_row_plans_only_the_differenceruns with a baseline that namesbuild_type: workflowand a live Pages site that answersbuild_type: legacy. - THEN The test asserts that row
pagesispending, that--plansends no write, and that--confirmsends one Pages write that holdsbuild_typealone.
Requirement: github-pages environment row
devops repos onboard SHALL compare the github-pages environment and its branch policy with the baseline and write only a difference.
Scenario: Plan a github-pages branch policy difference
- WHEN The test
tests/github/onboard/test_onboard_environments.py::test_github_pages_environment_plans_only_the_differenceruns with a baseline that names thegithub-pagesenvironment and the branch policymain, and a livegithub-pagesenvironment with no branch policy. - THEN The test asserts that the environment row reports
pendingforgithub-pages, that--plansends no write, and that--confirmwrites themainbranch policy ofgithub-pagesalone.
Requirement: Collaborator row
devops repos onboard SHALL compare each collaborator and permission of the baseline with the live set and write only the entries that differ.
Scenario: Plan a collaborator difference
- WHEN The test
tests/github/onboard/test_onboard_collaborators.py::test_collaborator_row_plans_only_the_differenceruns with a baseline that namesoctocat: maintainand a live set that holdsoctocat: pushandhubot: pull. - THEN The test asserts that row
collaboratorsispending, that--plansends no write, and that--confirmwritesoctocatwithmaintain, removeshubot, and sends no other collaborator write.
Requirement: One owner for each write route
Each write route of the new rows MUST name the command as its owner, and no route SHALL write a setting of another owner.
Scenario: Check the ownership of the new routes
- WHEN The test
tests/github/onboard/test_onboard_routes.py::test_no_route_writes_a_setting_of_another_ownerruns overROUTESwith the Pages, environment and collaborator routes. - THEN The test asserts that each new route names its owner and that no route matches
/orgs/,/transfer, an App installation or a repository secret.
Requirement: devops-cli baseline entry
The Copier template of dan-petty/infra SHALL hold the answers and the settings of dan-petty/devops-cli, including the release and github-pages environments, the Pages settings, the Actions workflow permissions, security_and_analysis and the collaborator set.
Scenario: Plan the devops-cli repository
- WHEN The owner runs
uv run devops repos onboard dan-petty/devops-cli --planwith their own login and the template at a release tag that holds the entry. - THEN The command reads every row from the baseline, reports no
not readablerow and nofailedrow, and exits 1 only withpendingrows.
Requirement: Owner apply
The owner MUST apply the baseline with their own login, and a second run on the onboarded repository SHALL send no write and exit 0.
Scenario: Apply the devops-cli baseline
- WHEN The owner runs
uv run devops repos onboard dan-petty/devops-cli --confirm, then runsuv run devops repos onboard dan-petty/devops-cli --plan. - THEN The first run ends each row
presentorapplied, and the second run exits 0 with nopendingrow.
Existing Tool Considered
The tool is integrations/terraform-provider-github (https://github.com/integrations/terraform-provider-github), MIT, maintained. The alternatives check of 2026-11-22 in the issue body gives it the verdict covers, and its block is the record of what the provider covers and lacks. The item adopts the provider and builds no replacement for it. ADR 0035 keeps OpenTofu for the organization postconditions and the transfer check and gives the repository settings of this item to devops repos onboard with the Copier baseline of dan-petty/infra, so this item extends that command and the baseline instead of declaring an OpenTofu resource; the block of the alternatives check applies only to the OpenTofu that remains.
Key questions
- The alternatives check found that
https://github.com/integrations/terraform-provider-githubcovers this item. Adopt the tool, or keep the item and give the reason.: Adopt integrations/terraform-provider-github, and apply ADR 0035 to this item: the provider stays for the OpenTofu that keeps the organization postconditions and the transfer check, and the repository settings of devops-cli go todevops repos onboardwith the Copier baseline of dan-petty/infra. The item builds no replacement for the provider and declares no OpenTofu resource for a repository setting. (best practice) [sources: AGENTS.md:9, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:47]- Chosen: Adopt integrations/terraform-provider-github. The alternatives check gives the open, maintained provider the verdict
covers, and ADR 0035 keeps it for the organization postconditions and the transfer check. - Rejected: Keep the OpenTofu stack that declares the repository settings. ADR 0035 section 6 amends decision 1 of ADR 0026: the shared module and the root stacks hold no repository setting.
- Rejected: Keep the item and give the reason. No reason holds: the provider is MIT, maintained and already in use for the OpenTofu that remains, and the repository settings have a home in the command.
- Chosen: Adopt integrations/terraform-provider-github. The alternatives check gives the open, maintained provider the verdict
- Where do the repository settings of dan-petty/devops-cli live now?: In the Copier baseline
github/repository.yamlof dan-petty/infra, rendered at a release tag and applied bydevops repos onboard. No OpenTofu stack, import block or data-source postcondition holds a repository setting. (best practice) [sources: docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:40, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:49, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:65, docs/repos/onboard.md:36, docs/adr/0032-infrastructure-templates-live-in-four-homes.md:69]- Chosen: The command with the Copier baseline of dan-petty/infra. ADR 0035 decision 1 gives the command the repository settings with one baseline in infra at a release tag, and ADR 0032 homes the template in infra.
- Rejected: An OpenTofu stack with import blocks. ADR 0035 section 6 amends decision 1 of ADR 0026, so the module and the stacks hold no repository setting.
- Rejected: Both the command and OpenTofu. Two copies of one setting drift, and ADR 0035 decision 2 forbids an OpenTofu resource that writes a setting the command owns.
- Which settings that this issue names does
devops repos onboardnot cover?: The Pages site settings, thegithub-pagesenvironment and the collaborator set. The rows of the command are 0 to 15, and none of them reads Pages, a second environment or a collaborator; the baseline schema namesrepository,vulnerability_alerts,private_vulnerability_reporting,immutable_releases,code_scanning_default_setup,actions_workflow_permissions,rulesetsandenvironments. [sources: docs/repos/onboard.md:44, docs/repos/onboard.md:61, tests/support/github_repository.py:55] - How should the change cover the Pages site, the
github-pagesenvironment and the collaborator set?: Add one row for each todevops repos onboard, with the keys in the baseline and in the schema of the template, because ADR 0035 gives the command the repository settings and its driver is that a repository gets each setting from one command run and no web UI step where GitHub has an API. The Pages row reusessrc/devops_cli/github/pages.py, which already reads the build type, the branch, the path, the custom domain and the HTTPS setting. (best practice) [sources: docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:18, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:40, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:43, docs/repos/onboard.md:42, src/devops_cli/github/pages.py:22]- Chosen: Extend
devops repos onboardwith three rows. ADR 0035 gives the repository settings to the command;src/devops_cli/github/pages.pyalready reads the Pages site, and each write route of the command names its owner. - Rejected: Leave the three settings to a person in the GitHub UI. A transfer would then have no baseline for them, and ADR 0035 decision 1 aims at no web UI step where GitHub has an API.
- Rejected: Keep an OpenTofu resource for the three settings. ADR 0035 decision 2 declares that no OpenTofu resource writes a setting that the command owns.
- Chosen: Extend
- How does the change assert the
mainruleset rule types without managing the ruleset?: It does not need a postcondition. ADR 0035 amends decision 7 of ADR 0026:devops repos onboardrow 10 reads the livemainruleset, compares it with the baseline and writes only a difference, so the change adds no data-source postcondition and nogithub_repository_rulesetresource. (best practice) [sources: docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:67, docs/repos/onboard.md:56, docs/repos/onboard.md:63]- Chosen: Row 10 of
devops repos onboardowns the ruleset. ADR 0035 decision 7 amendment gives the command themainruleset of each repository, and the command writes only a difference. - Rejected: A read-only postcondition on a data source. ADR 0035 decision 2 keeps only the organization postconditions and the transfer check in OpenTofu, and this item adds neither.
- Rejected: Leave the rule types unasserted. Row 10 compares the whole
mainruleset with the baseline and reports a difference, so the rule types are asserted.
- Chosen: Row 10 of
- How does the change keep environment secret values out of the baseline, the plan and the state?: The baseline names the secret
RELEASE_APP_PRIVATE_KEYand the variableRELEASE_APP_CLIENT_IDonly. The command seals the value from the configuration and writes it when it is missing, so no value enters the baseline, the plan, a log or an OpenTofu state. (best practice) [sources: docs/repos/onboard.md:52, AGENTS.md:16, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:22]- Chosen: Name the secret and read the value from the configuration. AGENTS.md forbids a secret in the repository, and row 6 checks the secret by name and seals the value with the code of
devops gh secret sync --env. - Rejected: Hold the value in the baseline. The value would enter the repository, the plan and the log, which AGENTS.md and ADR 0035 forbid.
- Chosen: Name the secret and read the value from the configuration. AGENTS.md forbids a secret in the repository, and row 6 checks the secret by name and seals the value with the code of
- Is build: add OpenTofu 1.13.9 to the devcontainer and runner images #5317 still a dependency?: No. build: add OpenTofu 1.13.9 to the devcontainer and runner images #5317 is delivered: OpenTofu 1.13.9 is on the devtools image and the CI gate reads it from there. [sources: openspec/changes/archive/2026-11-15-5317-add-opentofu-to-the-images/proposal.md, .github/workflows/ci.yml:80, CHANGELOG.md:1404]
- Are feat(tf): pass flags to tofu; add import, state, show, force-unlock #5318, fix(tf): devops tf drift exits non-zero on drift or a failed check #5319 and dan-petty/homelab#358 still dependencies?: No. This item now writes no OpenTofu resource, so it needs no stack, state namespace or import prerequisite. ADR 0035 keeps only the organization postconditions and the transfer check in OpenTofu, and this item builds neither. (best practice) [sources: docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:47, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:49, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:65]
- Chosen: Drop feat(tf): pass flags to tofu; add import, state, show, force-unlock #5318, fix(tf): devops tf drift exits non-zero on drift or a failed check #5319 and dan-petty/homelab#358. The item adds no OpenTofu stack or state, so a prerequisite of the removed stack gates nothing that remains.
- Rejected: Keep them. The item no longer writes an OpenTofu resource, so the prerequisites of that stack block no part of it.
- Where do the shared module and the root stacks live now?: ADR 0035 amends decision 1 of ADR 0026, so the shared module and the root stacks hold no repository setting. ADR 0032 homes the module in dan-petty/infra as
tf/modules/github-repositoryand the root stacks in dan-petty/homelab astf/github/, for the organization postconditions and the transfer check. This item adds neither. (best practice) [sources: docs/adr/0032-infrastructure-templates-live-in-four-homes.md:69, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:65, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:49]- Chosen: The ADR 0032 homes, for the OpenTofu that remains. ADR 0032 amends the paths of ADR 0026, and ADR 0035 keeps only the organization checks and the transfer check in OpenTofu.
- Rejected: The ADR 0026 homes in devops-cli. ADR 0032 moves the module to infra and the root stacks to homelab.
- Rejected: An OpenTofu stack that holds the repository settings. ADR 0035 section 6 amends decision 1 of ADR 0026.
- Who runs
devops repos onboard dan-petty/devops-cli, and when?: The owner, with their own gh login, after dan-petty/infra releases the baseline entry. Agents and the reader App run--planonly. The owner's--confirmrun is the apply, and a second--planrun proves that the repository is onboarded. (a person decides) [sources: AGENTS.md:21, docs/repos/onboard.md:71, docs/repos/onboard.md:24, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:40] - Who orders the work across dan-petty/devops-cli and dan-petty/infra?: The owner. The template in dan-petty/infra takes the new schema keys and the devops-cli entry at a release tag before the owner's run, because the roadmap enforces no blocker in another repository. (a person decides) [sources: docs/adr/0032-infrastructure-templates-live-in-four-homes.md:81, docs/adr/0035-the-onboard-command-owns-the-repository-settings.md:40]
- Which OpenTofu and provider versions run the OpenTofu that remains, and where is the pin?: OpenTofu 1.13.9 with
integrations/github6.13.0, at exact pins that Renovate updates. The devtools image installstofu, and the CI gate reads it from the image. This item changes neither pin. [sources: docs/adr/0026-github-settings-are-opentofu-code-the-owner-applies.md:16, .github/workflows/ci.yml:80]
Open questions
- Who runs
devops repos onboard dan-petty/devops-cli, and when? (a person decides) - Who orders the work across dan-petty/devops-cli and dan-petty/infra? (a person decides)
Fit
Needs splitting into 2 items:
- dan-petty/devops-cli: add the rows for the Pages site, the
github-pagesenvironment and the collaborator set todevops repos onboard, with the tests of each row and the row table ofdocs/repos/onboard.md. - dan-petty/infra: name the three keys in
templates/github-repository.schema.json, add the answers and the settings of dan-petty/devops-cli to the Copier template, release a tag, and let the owner runuv run devops repos onboard dan-petty/devops-cli --confirm.
Suspected block
The work waits on dan-petty/infra to release the Copier template with the new schema keys and the dan-petty/devops-cli entry at a tag; dan-petty/infra is outside this roadmap.
Dependencies
None.
Activity
dan-petty commentedon Nov 13, 2026
tf, and .github/labels.yml declares no scope/tf label. Add the label to the file to give the scope to this item.Both configure infrastructure for the devops-cli project, but dan-petty/devops-cli#5134 reads Argo CD environment from a homelab repo while this item declares and imports the GitHub repository in OpenTofu.devops-cli-service commentedon Nov 16, 2026
Alternatives check: in-use
Reason: Searches found that the GitHub provider for Terraform/OpenTofu (integrations/github) is the maintained tool that manages GitHub repository settings as code, and its docs and community answers show the import-block plus
-generate-config-outpath the issue proposes for importing an existing repository. The issue itself already names this provider (integrations/github 6.13.0) as the existing tool, so it covers the whole need, with OpenTofu providing the plan/apply engine and postconditions.The item already names this tool.
Tool: integrations/terraform-provider-github (https://github.com/integrations/terraform-provider-github)
Covers:
Lacks:
-generate-config-outmachinery is the OpenTofu engine, not the provider, so the generated draft still needs review and editsTools considered:
Searches run:
Sources:
Checked on 2026-11-16. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 17, 2026
Owner question: Who runs the import plan with the owner token, and who applies it? (a person decides)
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 21, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
devops-cli-service commentedon Nov 22, 2026
The result in the alternatives block of the issue body changed. Before this check:
in-use, tool https://github.com/integrations/terraform-provider-github. A person decides what the new result means for the item.Searches (5)
Tools considered:
Searches run:
Sources:
devops-cli-service commentedon Nov 22, 2026
Owner question: See the first point of Open questions in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
dan-petty commentedon Nov 24, 2026
Adopt the tool: terraform-provider-github. AGENTS.md rule 3 requires using an open tool before building.
devops-cli-service commentedon Nov 24, 2026
Owner question: See the first point of Open questions in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence
devops-cli-service commentedon Nov 25, 2026
Owner question: See the first point of Open questions in the section Proposed design of the body.
Options
Recommendation: Decide the question: only a person can answer it.
Evidence