Skip to content

Repository files navigation

Terraform Module: AWS GitHub Action Runner

This Terraform module deploys autoscaling, self-hosted GitHub Action runners on dedicated EC2 instances. It is an extension of the popular philips-labs/github-runner/aws module, with additional features to add value to your GitHub Action runners.

Features

  • Auto-Scaling Runners: Automatically scales the number of runners based on demand.
  • Ephemeral Runners: Provides an option to use ephemeral runners that are destroyed after use.
  • Tag-Based Runner Assignment: Uses tags to assign runners to specific tasks.
  • Custom Runner Configuration: Allows custom configuration of runners, including instance types, AMIs, and more.
  • Instance Store RAID: If more than 2 instance stores are detected, they are combined into a RAID0 configuration for improved performance.
  • Automated Docker Login: If custom Docker authentication is configured, the runners will automatically perform a docker login.

Usage

module"github_runner" {
source="cruxstack/github-runner/aws"version="x.x.x"github_app_secrets={
id ="your_github_app_id"
key ="your_github_app_key"
}
github_organization="your_github_organization_name"
}

Inputs

In addition to the variables documented below, this module includes several other optional variables (e.g., name, tags, etc.) provided by the cloudposse/label/null module. Please refer to the cloudposse/label documentation for more details on these variables.

NameDescriptionTypeDefaultRequired
github_app_secretsObject containing id and key for the GitHub app.objectn/ayes
github_organizationName of the GitHub organization.stringn/ayes
github_app_webhook_passwordPassword for the GitHub app webhook. An empty string implies a randomly generated password.string""no
github_organization_runner_enabledToggle to activate runners for all projects in the organization.booltrueno
runner_binaries_pathPath to the GitHub Action runner binaries saved locally before pushed to S3.string""no
runner_ephemeral_mode_enabledToggle to activate ephemeral runners.boolfalseno
runner_osOperating system for the GitHub Action runner.string"linux"no
instance_ami_nameName of the Amazon Machine Image (AMI) for the GitHub Action runner.string"al2023-ami-2023.*-kernel-*-x86_64"no
instance_typesSet of instance types for the action runner.set(string)["m5ad.large", "m5d.large"]no
instance_lifecycle_typeLifecycle type for action runner instances. Options: spot or on-demand.string"spot"no
log_retentionRetention period (in days) for logs in CloudWatch.number90no
vpc_idID of the Virtual Private Cloud (VPC).stringn/ayes
vpc_subnet_idsList of subnet IDs within the VPC.list(string)n/ayes
aws_region_nameAWS region.string""no
aws_account_idAWS account ID.string""no
aws_kv_namespaceNamespace or prefix for AWS SSM parameters and similar resources.string""no

Outputs

NameDescription
runnersInformation about the runner resources created.
webhook_endpointEndpoint for the webhook resources.
webhook_passwordPassword for the webhook resources.

Contributing

We welcome contributions to this project. For information on setting up a development environment and how to make a contribution, see CONTRIBUTING documentation.

Releases

Packages

Used by

Contributors

Languages