From 9f584d1673e4b207a38ea9e8382daddbef73e7f5 Mon Sep 17 00:00:00 2001 From: nlarzon Date: Thu, 28 May 2020 21:32:57 +0200 Subject: [PATCH 1/2] Asg metrics (#228) * Add metrics to autoscaling group fixes #180 * Add type in the variable Co-authored-by: Niklas Larsson L --- README.md | 1 + examples/runner-default/main.tf | 1 + main.tf | 2 +- variables.tf | 6 ++++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 378b0d28e..2c63ec9f6 100644 --- a/README.md +++ b/README.md @@ -296,6 +296,7 @@ terraform destroy | kms\_deletion\_window\_in\_days | Key rotation window, set to 0 for no rotation. Only used when `enable_kms` is set to `true`. | `number` | `7` | no | | kms\_key\_id | KMS key id to encrypted the CloudWatch logs. Ensure CloudWatch has access to the provided KMS key. | `string` | `""` | no | | log\_group\_name | Option to override the default name (`environment`) of the log group, requires `enable_cloudwatch_logging = true`. | `string` | `null` | no | +| metrics\_autoscaling | A list of metrics to collect. The allowed values are GroupDesiredCapacity, GroupInServiceCapacity, GroupPendingCapacity, GroupMinSize, GroupMaxSize, GroupInServiceInstances, GroupPendingInstances, GroupStandbyInstances, GroupStandbyCapacity, GroupTerminatingCapacity, GroupTerminatingInstances, GroupTotalCapacity, GroupTotalInstances. | `list(string)` | `null` | no | | overrides | This maps provides the possibility to override some defaults. The following attributes are supported: `name_sg` overwrite the `Name` tag for all security groups created by this module. `name_runner_agent_instance` override the `Name` tag for the ec2 instance defined in the auto launch configuration. `name_docker_machine_runners` ovverrid the `Name` tag spot instances created by the runner agent. | `map(string)` |
{
"name_docker_machine_runners": "",
"name_runner_agent_instance": "",
"name_sg": ""
}
| no | | permissions\_boundary | Name of permissions boundary policy to attach to AWS IAM roles | `string` | `""` | no | | runner\_ami\_filter | List of maps used to create the AMI filter for the Gitlab runner docker-machine AMI. | `map(list(string))` |
{
"name": [
"ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*"
]
}
| no | diff --git a/examples/runner-default/main.tf b/examples/runner-default/main.tf index 7c640db48..94f25aab5 100644 --- a/examples/runner-default/main.tf +++ b/examples/runner-default/main.tf @@ -36,6 +36,7 @@ module "runner" { vpc_id = module.vpc.vpc_id subnet_ids_gitlab_runner = module.vpc.private_subnets subnet_id_runners = element(module.vpc.private_subnets, 0) + metrics_autoscaling = ["GroupDesiredCapacity", "GroupInServiceCapacity"] runners_name = var.runner_name runners_gitlab_url = var.gitlab_url diff --git a/main.tf b/main.tf index e71e8f244..0f31d5fbb 100644 --- a/main.tf +++ b/main.tf @@ -150,7 +150,7 @@ resource "aws_autoscaling_group" "gitlab_runner_instance" { desired_capacity = "1" health_check_grace_period = 0 launch_configuration = aws_launch_configuration.gitlab_runner_instance.name - + enabled_metrics = var.metrics_autoscaling tags = concat( data.null_data_source.tags.*.outputs, [ diff --git a/variables.tf b/variables.tf index c8b0aca0c..e3c5719b4 100644 --- a/variables.tf +++ b/variables.tf @@ -35,6 +35,12 @@ variable "subnet_ids_gitlab_runner" { type = list(string) } +variable "metrics_autoscaling" { + description = "A list of metrics to collect. The allowed values are GroupDesiredCapacity, GroupInServiceCapacity, GroupPendingCapacity, GroupMinSize, GroupMaxSize, GroupInServiceInstances, GroupPendingInstances, GroupStandbyInstances, GroupStandbyCapacity, GroupTerminatingCapacity, GroupTerminatingInstances, GroupTotalCapacity, GroupTotalInstances." + type = list(string) + default = null +} + variable "instance_type" { description = "Instance type used for the GitLab runner." type = string From 65fd500da5aa7be0ffbd211f22be06f07ce945fa Mon Sep 17 00:00:00 2001 From: Niek Palm Date: Thu, 28 May 2020 21:40:03 +0200 Subject: [PATCH 2/2] Release 4.17.0 --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 164b539ac..12fd26a66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## Unreleased +## 4.17.0 - 2020-05-28 + +- Added: Asg metrics (#228) @nlarzonNiklas + ## 4.16.0 - 2020-05-22 - Bugfix: and update version (#224) @@ -357,7 +361,8 @@ Module is available as Terraform 0.11 module, pin module to version 3.x. Please - 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/4.16.0...HEAD +[unreleased]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/4.17.0...HEAD +[4.17.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/4.17.0...4.16.0 [4.16.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/4.16.0...4.15.0 [4.15.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/4.15.0...4.14.0 [4.14.0]: https://github.com/npalm/terraform-aws-gitlab-runner/compare/4.14.0...4.13.0