Skip to content

Commit

Permalink
Merge branch 'release/2.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
npalm committed Mar 19, 2019
2 parents 4b85921 + 0ff7cbb commit 0babdc9
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 38 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [2.2.1] - 2019-03-19
- Bugfix: Add tags to spot instances #39
- Changed: Updated terraform providers in examples and default terraform version

## [2.2.0] - 2019-03-08
- Changed: Upgrade default runner agent to 11.8.0 and docker machine to 0.16.1
- Bugfix: Correct example for docker_machine_options #36 (@declension)
Expand Down Expand Up @@ -94,7 +98,8 @@ 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/2.2.0...HEAD
[Unreleased]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/2.2.1...HEAD
[2.2.1]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/2.2.0...2.2.1
[2.2.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/2.1.0...2.2.0
[2.1.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/2.0.0...2.1.0
[2.0.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/1.8.0...2.0.0
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Build Status](https://travis-ci.com/npalm/terraform-aws-gitlab-runner.svg?branch=master)](https://travis-ci.com/npalm/terraform-aws-gitlab-runner)
[![Gitter](https://badges.gitter.im/terraform-aws-gitlab-runner/Lobby.svg)](https://gitter.im/terraform-aws-gitlab-runner/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

# Terraform module for GitLab auto scaling runners on Spot instances

Expand Down Expand Up @@ -157,7 +158,7 @@ module "gitlab-runner" {
| ssh_public_key | Public SSH key used for the gitlab-runner ec2 instance. | string | - | yes |
| subnet_id_runners | Subnet used to hosts the docker-machine runners. | string | - | yes |
| subnet_ids_gitlab_runner | Subnet used for hosting the gitlab-runner. | list | - | yes |
| tags | Map of tags that will be added to created resources. By default resources will be taggen with name and environemnt. | map | `<map>` | no |
| tags | Map of tags that will be added to created resources. By default resources will be tagged with name and environnemnt. | map | `<map>` | no |
| userdata_post_install | User-data script snippet to insert after gitlab-runner install | string | `` | no |
| userdata_pre_install | User-data script snippet to insert before gitlab-runner install | string | `` | no |
| vpc_id | The VPC that is used for the instances. | string | - | yes |
Expand Down
4 changes: 2 additions & 2 deletions ci/bin/run-local.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash

docker run --entrypoint="/bin/sh" -it --rm -w /build -v $(pwd):/build hashicorp/terraform:0.11.7 ./ci/bin/verify.sh
docker run --entrypoint="/bin/sh" -it --rm -w /build -v $(pwd):/build hashicorp/terraform:0.11.7 ./ci/bin/verify-examples.sh
docker run --entrypoint="/bin/sh" -it --rm -w /build -v $(pwd):/build hashicorp/terraform:0.11.13 ./ci/bin/verify.sh
docker run --entrypoint="/bin/sh" -it --rm -w /build -v $(pwd):/build hashicorp/terraform:0.11.13 ./ci/bin/verify-examples.sh
2 changes: 1 addition & 1 deletion ci/bin/terraform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
TARGET_DIR=/opt
PATH=${PATH}:${TARGET_DIR}

TERRAFORM_VERSION=${1:-"0.11.7"}
TERRAFORM_VERSION=${1:-"0.11.13"}
OS=${2:-"linux"}
TERRAFORM_URL="https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_${OS}_amd64.zip"

Expand Down
2 changes: 1 addition & 1 deletion examples/runner-default/.terraform-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.7
0.11.13
2 changes: 1 addition & 1 deletion examples/runner-default/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "1.37.0"
version = "1.59.0"

name = "vpc-${var.environment}"
cidr = "10.0.0.0/16"
Expand Down
8 changes: 4 additions & 4 deletions examples/runner-default/providers.tf
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
provider "aws" {
region = "${var.aws_region}"
version = "1.23"
version = "2.2"
}

provider "template" {
version = "1.0"
version = "2.1"
}

provider "local" {
version = "1.1"
}

provider "null" {
version = "1.0"
version = "2.1"
}

provider "tls" {
version = "1.1"
version = "1.2"
}
2 changes: 1 addition & 1 deletion examples/runner-docker/.terraform-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.7
0.11.13
2 changes: 1 addition & 1 deletion examples/runner-docker/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "1.37.0"
version = "1.59.0"

name = "vpc-${var.environment}"
cidr = "10.1.0.0/16"
Expand Down
8 changes: 4 additions & 4 deletions examples/runner-docker/providers.tf
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
provider "aws" {
region = "${var.aws_region}"
version = "1.23"
version = "2.2"
}

provider "template" {
version = "1.0"
version = "2.1"
}

provider "local" {
version = "1.1"
}

provider "null" {
version = "1.0"
version = "2.1"
}

provider "tls" {
version = "1.1"
version = "1.2"
}
2 changes: 1 addition & 1 deletion examples/runner-public/.terraform-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.7
0.11.13
2 changes: 1 addition & 1 deletion examples/runner-public/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "1.37.0"
version = "1.59.0"

name = "vpc-${var.environment}"
cidr = "10.1.0.0/16"
Expand Down
8 changes: 4 additions & 4 deletions examples/runner-public/providers.tf
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
provider "aws" {
region = "${var.aws_region}"
version = "1.23"
version = "2.2"
}

provider "template" {
version = "1.0"
version = "2.1"
}

provider "local" {
version = "1.1"
}

provider "null" {
version = "1.0"
version = "2.1"
}

provider "tls" {
version = "1.1"
version = "1.2"
}
26 changes: 12 additions & 14 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,19 @@ data "template_file" "runners" {
template = "${file("${path.module}/template/runner-config.tpl")}"

vars {
aws_region = "${var.aws_region}"
gitlab_url = "${var.runners_gitlab_url}"
environment = "${var.environment}"

runners_vpc_id = "${var.vpc_id}"
runners_subnet_id = "${var.subnet_id_runners}"
runners_aws_zone = "${var.aws_zone}"
runners_instance_type = "${var.docker_machine_instance_type}"
runners_spot_price_bid = "${var.docker_machine_spot_price_bid}"
runners_security_group_name = "${aws_security_group.docker_machine.name}"
runners_monitoring = "${var.runners_monitoring}"

docker_machine_options = "${length(var.docker_machine_options) == 0 ? "" : local.docker_machine_options_string}"

aws_region = "${var.aws_region}"
gitlab_url = "${var.runners_gitlab_url}"

runners_vpc_id = "${var.vpc_id}"
runners_subnet_id = "${var.subnet_id_runners}"
runners_aws_zone = "${var.aws_zone}"
runners_instance_type = "${var.docker_machine_instance_type}"
runners_spot_price_bid = "${var.docker_machine_spot_price_bid}"
runners_security_group_name = "${aws_security_group.docker_machine.name}"
runners_monitoring = "${var.runners_monitoring}"
docker_machine_options = "${length(var.docker_machine_options) == 0 ? "" : local.docker_machine_options_string}"
runners_name = "${var.runners_name}"
runners_tags = "${local.tags_string}"
runners_token = "${var.runners_token}"
runners_executor = "${var.runners_executor}"
runners_limit = "${var.runners_limit}"
Expand Down
2 changes: 2 additions & 0 deletions tags.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ locals {
tags = "${merge(map("Name", format("%s", var.environment)),
map("Environment", format("%s", var.environment)),
var.tags)}"

tags_string = "${replace(replace(jsonencode(local.tags), "/[\\{\\}\"\\s]/", ""), ":", ",")}"
}

data "null_data_source" "tags" {
Expand Down
2 changes: 1 addition & 1 deletion template/runner-config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ check_interval = 0
"amazonec2-request-spot-instance=true",
"amazonec2-spot-price=${runners_spot_price_bid}",
"amazonec2-security-group=${runners_security_group_name}",
"amazonec2-tags=environment,${environment}",
"amazonec2-tags=${runners_tags}",
"amazonec2-monitoring=${runners_monitoring}",
"amazonec2-root-size=${runners_root_size}"
${docker_machine_options}
Expand Down

0 comments on commit 0babdc9

Please sign in to comment.