Skip to content

Converge the 56 managed repositories with terraform apply #3

Description

@matt-edmondson

Context

The Terraform workspace can import and converge the 56 managed repositories, but terraform apply has never been run. github/repositories.tf does not exist yet.

What it would change

The apply was simulated against live API data for all 56 repos before anything was written:

  • Descriptions: 0 changes. No repo's derived description differs from what GitHub holds.
  • Topics: 2 changes. GitBranchStateCache gains 20 topics from an empty set. ProjectDirector swaps 4, and its TAGS.md has already been trimmed so dotnet and csharp survive the 20-topic cap.
  • Settings: merge methods on 56, wiki off on 54, projects off on 56, homepage filled on 22.

No repository is created or destroyed. Every resource carries prevent_destroy and archive_on_destroy, so Terraform cannot delete a repo. Removing one from the configuration is an error, not a deletion.

Prerequisites

  • A GitHub PAT with admin:org. The current token carries only gist, read:org, repo, and workflow, and org-scoped calls return 403 without it.
  • The deprecated-attribute issue should be resolved first, since default_branch is computed and setting it on github_repository is a no-op.

Acceptance criteria

  • github/repositories.tf written, with prevent_destroy and archive_on_destroy on every resource
  • github/imports.tf written using import blocks with for_each
  • The plan contains zero creates and zero destroys. A proposed create means a name does not match a real repo, and applying would make a new empty repository. Treat it as a stop condition.
  • Applied, then terraform plan returns a clean exit code 0
  • github/imports.tf deleted after the first successful apply

Note for the implementer

github_repository.topics is computed. Omitting it preserves live topics, setting [] wipes them. local.defaults carries three keys that are not github_repository arguments (default_branch, description_override, topics_override), so the resource must name its fields explicitly rather than splatting the map.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions