Terraform files for managing organization infrastructure. See INSTALL.md
for instructions on how to prepare this setup from scratch on GitHub.
In order to add a new user to an existing team, follow these steps:
variable "teams"
section.members
array of the respective team.In order to add new repositories, so that the respective permissions / protections are applied automatically, follow these steps:
Add the repository in the variable "repositories"
> default
section replacing the placeholders:
{{REPOSITORY_NAME}} = {
description = "{{DESCRIPTION}}"
teams = [
"{{TEAM_NAME}}"
]
}
Terraform will then automatically create this repository with the appropriate settings. If you created the repository manually on GitHub before, you need to manually import that repository into Terraform. Therefore, run the following Terraform command locally:
For source repositories:
terraform import github_repository.repositories[\"your-repository-name\"] your-repository-name
For mirror repositories:
terraform import github_repository.mirrors[\"your-mirror-repository-name\"] your-mirror-repository-name
The process for changing Terraform configuration is as follows:
In general, we run Terraform via GitHub Actions. However, in certain cases, it might be handy to execute Terraform locally. Therefore, install Terraform and set the following environment variables:
TF_VAR_github_app_id
: The ID of the Mage-OS Terraform GitHub App, which is shown at https://github.com/organizations/mage-os/settings/apps/mage-os-terraform.TF_VAR_github_app_installation_id
: The installation ID of the Mage-OS Terraform GitHub App, which you find in the URL when you click on "Configure" for the respective app on https://github.com/organizations/mage-os/settings/installations.TF_VAR_app_node_id
: The node ID of the app, which you find out as described in the installation docs.TF_VAR_github_app_pem_file
: The contents of the private key that you can create on https://github.com/organizations/mage-os/settings/apps/mage-os-terraform.GOOGLE_APPLICATION_CREDENTIALS
: The (preferably absolute) path to the key file you can generate in Google Cloud > IAM & Admin > Service Accounts > Mage-OS Terraform account > Keys.