Skip to content

Terraform module which provisions EC2 instances as Docker Runners for Gitlab Projects

Notifications You must be signed in to change notification settings

infraspecdev/terraform-aws-gitlab-docker-runner

Repository files navigation

gitlab-docker-runner

This Terraform module creates a GitLab Runner on AWS using one or more EC2 instances. The runner is registered with the provided GitLab instance and is capable of running Docker-based builds. Additionally, the module creates an AWS Key Pair that can be used to SSH into the EC2 instances.

Usage

module "gitlab_docker_runner" {
  source = "https://github.com/infraspecdev/terraform-aws-gitlab-docker-runner"
    
  ami_id                    = "ami-0675b5ed3c8c1f754"
  instance_type             = "t2.micro"
  instance_count            = 1
  vpc_security_group_ids    = ["sg-0b0b0b0b0b0b0b0b0"]
  subnet_id                 = "subnet-0b0e1c4b5b1b1b1b1"
  gitlab_url                = "https://gitlab.example.com"
  runner_registration_token = "runner-registration-token-here"
  ssh_public_key            = "ssh-public-key-here"
}

Examples

Example

Requirements

Name Version
terraform ~> 1.3.0
aws >= 4.49.0

Providers

Name Version
aws 4.49.0

Modules

No modules.

Resources

Name Type
aws_instance.this resource
aws_key_pair.this resource

Inputs

Name Description Type Default Required
additional_tags Additional tags to apply to the resources map(string) {} no
ami_id AMI to use for the instance string "ami-0675b5ed3c8c1f754" no
docker_image Docker image to use string "alpine" no
gitlab_url URL of your Gitlab instance string n/a yes
instance_count Number of instances to provision number 1 no
instance_type Type of instance to provision string "t2.micro" no
run_untagged_jobs Should run untagged jobs or not bool true no
runner_description Description for Gitlab Runners string "Docker Runner" no
runner_locked Should Lock the runners or not bool false no
runner_registration_token Registration token for Gitlab Runners string n/a yes
runner_tags Tags for Gitlab Runners for filtering list(string)
[
"docker",
"aws"
]
no
ssh_public_key Existing SSH public key to use for the key pair string null no
subnet_id VPC Subnet ID to launch in string n/a yes
vpc_security_group_ids List of security group IDs to associate list(string) n/a yes

Outputs

No outputs.

Authors

Module maintained by Infraspec.

About

Terraform module which provisions EC2 instances as Docker Runners for Gitlab Projects

Resources

Stars

Watchers

Forks

Packages

No packages published