Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/infraspecdev/terraform-aws-gitlab-docker-runner

Terraform module which provisions EC2 instances as Docker Runners for Gitlab Projects
https://github.com/infraspecdev/terraform-aws-gitlab-docker-runner

Last synced: 3 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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

```hcl
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](examples/gitlab-docker-runner-setup)

## Requirements

| Name | Version |
|------|---------|
| [terraform](#requirement\_terraform) | ~> 1.3.0 |
| [aws](#requirement\_aws) | >= 4.49.0 |

## Providers

| Name | Version |
|------|---------|
| [aws](#provider\_aws) | 4.49.0 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_instance.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance) | resource |
| [aws_key_pair.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/key_pair) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [additional\_tags](#input\_additional\_tags) | Additional tags to apply to the resources | `map(string)` | `{}` | no |
| [ami\_id](#input\_ami\_id) | AMI to use for the instance | `string` | `"ami-0675b5ed3c8c1f754"` | no |
| [docker\_image](#input\_docker\_image) | Docker image to use | `string` | `"alpine"` | no |
| [gitlab\_url](#input\_gitlab\_url) | URL of your Gitlab instance | `string` | n/a | yes |
| [instance\_count](#input\_instance\_count) | Number of instances to provision | `number` | `1` | no |
| [instance\_type](#input\_instance\_type) | Type of instance to provision | `string` | `"t2.micro"` | no |
| [run\_untagged\_jobs](#input\_run\_untagged\_jobs) | Should run untagged jobs or not | `bool` | `true` | no |
| [runner\_description](#input\_runner\_description) | Description for Gitlab Runners | `string` | `"Docker Runner"` | no |
| [runner\_locked](#input\_runner\_locked) | Should Lock the runners or not | `bool` | `false` | no |
| [runner\_registration\_token](#input\_runner\_registration\_token) | Registration token for Gitlab Runners | `string` | n/a | yes |
| [runner\_tags](#input\_runner\_tags) | Tags for Gitlab Runners for filtering | `list(string)` |

[
"docker",
"aws"
]
| no |
| [ssh\_public\_key](#input\_ssh\_public\_key) | Existing SSH public key to use for the key pair | `string` | `null` | no |
| [subnet\_id](#input\_subnet\_id) | VPC Subnet ID to launch in | `string` | n/a | yes |
| [vpc\_security\_group\_ids](#input\_vpc\_security\_group\_ids) | List of security group IDs to associate | `list(string)` | n/a | yes |

## Outputs

No outputs.

## Authors

Module maintained by [Infraspec](https://github.com/infraspecdev).