Private Runners
Terrateam leverages GitHub Actions to execute Terraform operations, such as plan and apply, in response to various events like pull requests and commits. By default, these operations run on GitHub-hosted runners, which are managed and maintained by GitHub. However, in some cases, you may want to use your own infrastructure to run these operations. This is where GitHub Actions self-hosted runners, also known as private runners, come into play.
What are Private Runners?
Private runners, or self-hosted runners, are instances of the GitHub Actions runner application that you deploy and manage on your own infrastructure. These runners can be physical machines, virtual machines, or containers that you configure to run GitHub Actions workflows. Using private runners with Terrateam allows you to:
- Run Terrateam operations on your own infrastructure, giving you more control over the environment and resources.
- Access private resources or services that are not accessible from the public internet, such as internal APIs or databases.
- Comply with security or regulatory requirements that mandate running operations on your own infrastructure.
- Customize the runner environment with specific software, tools, or configurations required by your Terraform workflows.
Terrateam Self-Hosted Runner
Terrateam provides a Docker container that simplifies the process of setting up and running a self-hosted runner for Terrateam operations.
Steps
-
Add a self-hosted runner to your organization:
1. On GitHub.com, navigate to the main page of the organization.
2. Under your organization name, click
Settings
.3. In the left sidebar, click
Actions
, then clickRunners
.4. Click
New runner
, then clickNew self-hosted runner
.5. Select
x86
6. Note the token for the next step
-
Run the docker container however you run containers:
Replace
myGithubOrg
with your GitHub organization name andrunnerToken
with the runner token obtained from the GitHub Actions settings page. -
Update your Terrateam GitHub Actions workflow file (
.github/workflows/terrateam.yml
) to use the self-hosted runner:
The Terrateam self-hosted runner Docker container simplifies the setup process and ensures that your runner has all the necessary dependencies and configurations required by Terrateam.
Manual Setup Instructions
If you prefer to set up the self-hosted runner manually or have specific requirements, you can follow the steps below to configure a self-hosted runner for Terrateam.
Steps
-
Prepare your infrastructure:
1. Provision a machine or virtual machine that meets the minimum requirements for running GitHub Actions workflows.
2. Ensure the machine has the necessary permissions and network access to communicate with your GitHub repository and any required resources.
-
Install the runner application:
1. Download the appropriate version of the runner application for your operating system from the GitHub Actions releases page.
2. Extract the runner application and navigate to the installation directory.
-
Configure the runner:
1. Run the
config.sh
(Linux/macOS) orconfig.cmd
(Windows) script to configure the runner.2. Choose whether to run the runner as a service or manually.
-
Start the runner:
1. Run the
run.sh
(Linux/macOS) orrun.cmd
(Windows) script to start the runner.2. The runner will register itself with your GitHub repository and start listening for workflow jobs.
-
Update your Terrateam GitHub Actions workflow file (
.github/workflows/terrateam.yml
) to use the self-hosted runner:Replace
self-hosted
with the label or name of your self-hosted runner if you have multiple runners configured. -
Commit and push the changes to your workflow file.
For detailed instructions on setting up self-hosted runners, refer to the GitHub Actions documentation.