Create repositories through org/modules/github/repository. The module applies
the private visibility, merge settings, feature settings, Actions access, and
destruction protection used by StormTrust.
-
In
org/github/, add a module call for the repository.module "example_service_repository" { source = "../modules/github/repository" name = "example-service" actions_access_level = "none" } -
Run
make fmtandmake verifyfrom the repository root. -
Follow the pull request workflow. Terraform creates the empty GitHub repository during the post-merge apply.
-
After the apply succeeds, push the first repository commit.
New repositories do not need import blocks. Do not create them first with the GitHub CLI or dashboard.
Declare an existing repository through the same module. Add an import block so Terraform binds the remote repository to its state address.
import {
to = module.example_service_repository.github_repository.this
id = "example-service"
}Retain the import block as an adoption and state-recovery record. The first plan must not add, replace, or destroy the repository.