Skip to content

Commit

Permalink
Feature/terraform 0.12 sync develop (#103)
Browse files Browse the repository at this point in the history
Sync develop branch to tf 0.12 branch

* Fix misleading variable description (#86)

* changed the description for the variable `enable_manage_gitlab_token`, since the second part of the description was misleading

* rewritten the description of the variable `enable_manage_gitlab_token` based on feedback from PR

* update changelog

* ci script update (#90)

* ci/bin/autodocs.sh: exit if dependencies are not installed
(pandoc or terraform-docs)

* ci/bin/verify-examples: make check for examples working
and not print some obscure error messages

* Adding docker pull policy Parameter (#89)

* adding pull policy parameter

* update documentation from master

* runautodocs

* regenerate README

* adding paramter to allow specify docker-machine ami

this allows us to also use the latest ubuntu 18.04
for the docker-machine instances

* adding paramter to allow specify docker-machine ami (#88)

this allows us to also use the latest ubuntu 18.04
for the docker-machine instances

* Update docs

* Release 3.6.0

* fix: availability zone in AWS region (#93)

* fix: availability zone in AWS region

* fix: use data source to determine az

* fix: use a variable to determine timezone (#94)

* fix: use a variable to determine timezone

* fix: update documentation

* Fix broken public example

* Move cache to moudle (#96)

FIx #91

* Release 3.7.0

* Add variable docker_machine_role_json allowing role policy customization (#100)

* Add variable docker_machine_role_json allowing role policy customization

* Update docs

* Add variable docker_machine_ssh_cidr_blocks allowing ssh ingress restriction (#101)

* Update names for docker machine security-rules (#102)

* Fix merge mistake

* Fix merge mistake
  • Loading branch information
npalm committed Jul 22, 2019
1 parent 13455c1 commit 0340c08
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 19 deletions.
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## 3.7.0 - 2019-07-17
- Changed
- Creation of multiple instances of the runner is now supported. Cache is therefor moved to an internal module. Pleas see the example `runner-public` for a concrete sample. The change should have no effect if you apply the state migration script `migragations/migration-state-3.7.x.sh`.
- Examples are more generic by removing the time zone and AZ zone to variables. @@theBenForce

## 3.6.0 - 2019-07-04
- Changed
- Add option to specify pull policy for docker images by the runner. @roock
- Docker machine AMI image will be by default latest ubuntu 16.06, can be overwritten via variables @roock
- Improved CI docs generation script @roock

## 3.5.0 - 2019-06-19
- Changed
- Documentation #85: Misleading Variable-Description @solutionDrive-Alt
- Bugfix #70: docker-machine fails starting runners when `amazonec2-request-spot-instance=false` @philippefuentes
- Bugfix #72: Detect and retry when docker machine installation fails @eliasdorneles
- Changed: Default version of GitLab runner set to 11.11.2

## [3.4.0] - 2019-06-06
- Changed:
- Update default runner type, GitLab runner version, and versions in examples.
Expand Down Expand Up @@ -126,7 +144,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Update default AMI's to The latest Amazon Linux AMI 2017.09.1 - released on 2018-01-17.
- Minor updates in the example

[Unreleased]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/3.4.0...HEAD
[Unreleased]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/3.7.0...HEAD
[3.7.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/3.6.0...3.7.0
[3.6.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/3.5.0...3.6.0
[3.5.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/3.4.0...3.5.0
[3.4.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/3.3.0...3.4.0
[3.3.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/3.2.0...3.3.0
[3.2.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/3.1.0...3.2.0
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ terraform destroy
| runner\_ami\_filter | List of maps used to create the AMI filter for the Gitlab runner docker-machine AMI. | map(list(string)) | `<map>` | no |
| runner\_ami\_owners | The list of owners used to select the AMI of Gitlab runner docker-machine instances. | list(string) | `<list>` | no |
| runner\_instance\_spot\_price | By setting a spot price bid price the runner agent will be created via a spot request. Be aware that spot instances can be stopped by AWS. | string | `""` | no |
| runners\_additional\_volumes | Additional volumes that will be used in the runner config.toml, e.g Docker socket | list | `<list>` | no |
| runners\_concurrent | Concurrent value for the runners, will be used in the runner config.toml. | string | `"10"` | no |
| runners\_docker\_socket | Location of Docker socket on host if socket mount if enabled, will be used in the runner config.toml | string | `"/var/run/docker.sock:/var/run/docker.sock"` | no |
| runners\_environment\_vars | Environment variables during build execution, e.g. KEY=Value, see runner-public example. Will be used in the runner config.toml | list(string) | `<list>` | no |
| runners\_executor | The executor to use. Currently supports `docker+machine` or `docker`. | string | `"docker+machine"` | no |
| runners\_gitlab\_url | URL of the GitLab instance to connect to. | string | n/a | yes |
Expand All @@ -242,7 +242,6 @@ terraform destroy
| runners\_image | Image to run builds, will be used in the runner config.toml | string | `"docker:18.03.1-ce"` | no |
| runners\_limit | Limit for the runners, will be used in the runner config.toml. | string | `"0"` | no |
| runners\_monitoring | Enable detailed cloudwatch monitoring for spot instances. | string | `"false"` | no |
| runners\_mount\_docker\_socket | Runners will mount volume with Docker socket, will be used in the runner config.toml | string | `"false"` | no |
| runners\_name | Name of the runner, will be used in the runner config.toml. | string | n/a | yes |
| runners\_off\_peak\_idle\_count | Off peak idle count of the runners, will be used in the runner config.toml. | string | `"0"` | no |
| runners\_off\_peak\_idle\_time | Off peak idle time of the runners, will be used in the runner config.toml. | string | `"0"` | no |
Expand All @@ -261,7 +260,7 @@ terraform destroy
| runners\_use\_private\_address | Restrict runners to the use of a private IP address | string | `"true"` | no |
| secure\_parameter\_store\_runner\_token\_key | The key name used store the Gitlab runner token in Secure Parameter Store | string | `"runner-token"` | no |
| ssh\_key\_pair | Set this to use existing AWS key pair | string | `""` | no |
| ssh\_public\_key | Public SSH key used for the GitLab runner EC2 instance. | string | n/a | yes |
| ssh\_public\_key | Public SSH key used for the GitLab runner EC2 instance. | string | `""` | no |
| subnet\_id\_runners | List of subnets used for hosting the gitlab-runners. | string | n/a | yes |
| subnet\_ids\_gitlab\_runner | Subnet used for hosting the GitLab runner. | list(string) | n/a | yes |
| tags | Map of tags that will be added to created resources. By default resources will be tagged with name and environment. | map(string) | `<map>` | no |
Expand All @@ -273,7 +272,10 @@ terraform destroy

| Name | Description |
|------|-------------|
| runner\_agent\_role | ARN of the role used for the ec2 instance for the GitLab runner agent. |
| runner\_agent\_role\_arn | ARN of the role used for the ec2 instance for the GitLab runner agent. |
| runner\_agent\_role\_name | Name of the role used for the ec2 instance for the GitLab runner agent. |
| runner\_as\_group\_name | Name of the autoscaling group for the gitlab-runner instance |
| runner\_cache\_bucket\_arn | ARN of the S3 for the build cache. |
| runner\_role | ARN of the role used for the docker machine runners. |
| runner\_cache\_bucket\_name | Name of the S3 for the build cache. |
| runner\_role\_arn | ARN of the role used for the docker machine runners. |
| runner\_role\_name | Name of the role used for the docker machine runners. |
12 changes: 7 additions & 5 deletions _docs/TF_MODULE.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
| runner\_ami\_filter | List of maps used to create the AMI filter for the Gitlab runner docker-machine AMI. | map(list(string)) | `<map>` | no |
| runner\_ami\_owners | The list of owners used to select the AMI of Gitlab runner docker-machine instances. | list(string) | `<list>` | no |
| runner\_instance\_spot\_price | By setting a spot price bid price the runner agent will be created via a spot request. Be aware that spot instances can be stopped by AWS. | string | `""` | no |
| runners\_additional\_volumes | Additional volumes that will be used in the runner config.toml, e.g Docker socket | list | `<list>` | no |
| runners\_concurrent | Concurrent value for the runners, will be used in the runner config.toml. | string | `"10"` | no |
| runners\_docker\_socket | Location of Docker socket on host if socket mount if enabled, will be used in the runner config.toml | string | `"/var/run/docker.sock:/var/run/docker.sock"` | no |
| runners\_environment\_vars | Environment variables during build execution, e.g. KEY=Value, see runner-public example. Will be used in the runner config.toml | list(string) | `<list>` | no |
| runners\_executor | The executor to use. Currently supports `docker+machine` or `docker`. | string | `"docker+machine"` | no |
| runners\_gitlab\_url | URL of the GitLab instance to connect to. | string | n/a | yes |
Expand All @@ -45,7 +45,6 @@
| runners\_image | Image to run builds, will be used in the runner config.toml | string | `"docker:18.03.1-ce"` | no |
| runners\_limit | Limit for the runners, will be used in the runner config.toml. | string | `"0"` | no |
| runners\_monitoring | Enable detailed cloudwatch monitoring for spot instances. | string | `"false"` | no |
| runners\_mount\_docker\_socket | Runners will mount volume with Docker socket, will be used in the runner config.toml | string | `"false"` | no |
| runners\_name | Name of the runner, will be used in the runner config.toml. | string | n/a | yes |
| runners\_off\_peak\_idle\_count | Off peak idle count of the runners, will be used in the runner config.toml. | string | `"0"` | no |
| runners\_off\_peak\_idle\_time | Off peak idle time of the runners, will be used in the runner config.toml. | string | `"0"` | no |
Expand All @@ -64,7 +63,7 @@
| runners\_use\_private\_address | Restrict runners to the use of a private IP address | string | `"true"` | no |
| secure\_parameter\_store\_runner\_token\_key | The key name used store the Gitlab runner token in Secure Parameter Store | string | `"runner-token"` | no |
| ssh\_key\_pair | Set this to use existing AWS key pair | string | `""` | no |
| ssh\_public\_key | Public SSH key used for the GitLab runner EC2 instance. | string | n/a | yes |
| ssh\_public\_key | Public SSH key used for the GitLab runner EC2 instance. | string | `""` | no |
| subnet\_id\_runners | List of subnets used for hosting the gitlab-runners. | string | n/a | yes |
| subnet\_ids\_gitlab\_runner | Subnet used for hosting the GitLab runner. | list(string) | n/a | yes |
| tags | Map of tags that will be added to created resources. By default resources will be tagged with name and environment. | map(string) | `<map>` | no |
Expand All @@ -76,8 +75,11 @@

| Name | Description |
|------|-------------|
| runner\_agent\_role | ARN of the role used for the ec2 instance for the GitLab runner agent. |
| runner\_agent\_role\_arn | ARN of the role used for the ec2 instance for the GitLab runner agent. |
| runner\_agent\_role\_name | Name of the role used for the ec2 instance for the GitLab runner agent. |
| runner\_as\_group\_name | Name of the autoscaling group for the gitlab-runner instance |
| runner\_cache\_bucket\_arn | ARN of the S3 for the build cache. |
| runner\_role | ARN of the role used for the docker machine runners. |
| runner\_cache\_bucket\_name | Name of the S3 for the build cache. |
| runner\_role\_arn | ARN of the role used for the docker machine runners. |
| runner\_role\_name | Name of the role used for the docker machine runners. |

1 change: 0 additions & 1 deletion ci/bin/autodocs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
pandoc -v &> /dev/null || { echo >&2 "ERROR: Pandoc not installed" ; exit 1 ; }
terraform-docs --version &> /dev/null || { echo >&2 "ERROR: terraform-docs not installed" ; exit 1 ; }


IFS=$'\n'
# create an array of all unique directories containing .tf files
arr=($(find . -name '*.tf' | xargs -I % sh -c 'dirname %' | sort -u))
Expand Down
2 changes: 1 addition & 1 deletion examples/runner-default/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This examples shows:
- Registration via GitLab token.
- Auto scaling using `docker+machine` executor.

## Prerequisite
![runners-default](https://github.com/npalm/assets/raw/master/images/terraform-aws-gitlab-runner/runner-default.png)

The Terraform version is managed using [tfenv](https://github.com/Zordrak/tfenv). If you are not using `tfenv` please check `.terraform-version` for the tested version.

Expand Down
4 changes: 2 additions & 2 deletions examples/runner-default/_docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This examples shows:
- Auto scaling using `docker+machine` executor.


## Prerequisite
![runners-default](https://github.com/npalm/assets/raw/master/images/terraform-aws-gitlab-runner/runner-default.png)

The Terraform version is managed using [tfenv](https://github.com/Zordrak/tfenv). If you are not using `tfenv` please check `.terraform-version` for the tested version.

Expand All @@ -27,4 +27,4 @@ This examples shows:
- Usages of public / private subnets.
- Usages of runner of peak time mode configuration.
- Registration via GitLab token.
- Auto scaling using `docker+machine` executor.
- Auto scaling using `docker+machine` executor.
2 changes: 1 addition & 1 deletion examples/runner-public/_docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ This examples shows:

## Prerequisite

The Terraform version is managed using [tfenv](https://github.com/Zordrak/tfenv). If you are not using `tfenv` please check `.terraform-version` for the tested version.
The Terraform version is managed using [tfenv](https://github.com/Zordrak/tfenv). If you are not using `tfenv` please check `.terraform-version` for the tested version.
2 changes: 1 addition & 1 deletion examples/runner-public/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module "runner" {
runners_gitlab_url = var.gitlab_url
runners_environment_vars = ["KEY=Value", "FOO=bar"]

runners_privileged = "false"
runners_privileged = "false"
runners_additional_volumes = ["/var/run/docker.sock:/var/run/docker.sock"]

gitlab_runner_registration_config = {
Expand Down
1 change: 0 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ resource "aws_launch_configuration" "gitlab_runner_instance" {
}
}


################################################################################
### Create cache bucket
################################################################################
Expand Down
7 changes: 7 additions & 0 deletions migrations/migration-state-3.7.x.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

echo ---
echo --- Migration state for updates in Release 3.7.0
echo ---
terraform state mv module.runner.aws_s3_bucket.build_cache module.runner.module.cache.aws_s3_bucket.build_cache
terraform state mv module.runner.aws_iam_policy.docker_machine_cache module.runner.module.cache.aws_iam_policy.docker_machine_cache
1 change: 0 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ variable "runner_ami_owners" {
default = ["099720109477"]
}


variable "gitlab_runner_registration_config" {
description = "Configuration used to register the runner. See the README for an example, or reference the examples in the examples directory of this repo."
type = map(string)
Expand Down

0 comments on commit 0340c08

Please sign in to comment.