Skip to content

Commit 8515137

Browse files
joshbeardnpalm
authored andcommitted
feat: Add support ASG maximum instance lifetime (#385)
Add a new `asg_max_instance_lifetime` input which can be used to set the ASG maximum instance lifetime as described at https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-max-instance-lifetime.html.
1 parent f80accd commit 8515137

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ terraform destroy
343343
| <a name="input_docker_machine_spot_price_bid"></a> [docker\_machine\_spot\_price\_bid](#input\_docker\_machine\_spot\_price\_bid) | Spot price bid. | `string` | `"0.06"` | no |
344344
| <a name="input_docker_machine_version"></a> [docker\_machine\_version](#input\_docker\_machine\_version) | By default docker\_machine\_download\_url is used to set the docker machine version. Version of docker-machine. The version will be ingored once `docker_machine_download_url` is set. | `string` | `""` | no |
345345
| <a name="input_enable_asg_recreation"></a> [enable\_asg\_recreation](#input\_enable\_asg\_recreation) | Enable automatic redeployment of the Runner ASG when the Launch Configs change. | `bool` | `true` | no |
346+
| <a name="input_asg_max_instance_lifetime"></a> [asg\_max\_instance\_lifetime](#input\_asg\_max\_instance\_lifetime) | The seconds before an instance is refreshed in the ASG. | `number` | `null` | no |
346347
| <a name="input_enable_cloudwatch_logging"></a> [enable\_cloudwatch\_logging](#input\_enable\_cloudwatch\_logging) | Boolean used to enable or disable the CloudWatch logging. | `bool` | `true` | no |
347348
| <a name="input_enable_docker_machine_ssm_access"></a> [enable\_docker\_machine\_ssm\_access](#input\_enable\_docker\_machine\_ssm\_access) | Add IAM policies to the docker-machine instances to connect via the Session Manager. | `bool` | `false` | no |
348349
| <a name="input_enable_eip"></a> [enable\_eip](#input\_enable\_eip) | Enable the assignment of an EIP to the gitlab runner instance | `bool` | `false` | no |

Diff for: main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@ resource "aws_autoscaling_group" "gitlab_runner_instance" {
177177
max_size = "1"
178178
desired_capacity = "1"
179179
health_check_grace_period = 0
180+
max_instance_lifetime = var.asg_max_instance_lifetime
180181
enabled_metrics = var.metrics_autoscaling
181182
tags = local.agent_tags_propagated
182183

183-
184184
launch_template {
185185
id = aws_launch_template.gitlab_runner_instance.id
186186
version = aws_launch_template.gitlab_runner_instance.latest_version

Diff for: variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,12 @@ variable "asg_delete_timeout" {
695695
type = string
696696
}
697697

698+
variable "asg_max_instance_lifetime" {
699+
description = "The seconds before an instance is refreshed in the ASG."
700+
default = null
701+
type = number
702+
}
703+
698704
variable "enable_forced_updates" {
699705
description = "DEPRECATED! and is replaced by `enable_asg_recreation. Setting this variable to true will do the opposite as expected. For backward compatibility the variable will remain some releases. Old desription: Enable automatic redeployment of the Runner ASG when the Launch Configs change."
700706
default = null

0 commit comments

Comments
 (0)