diff --git a/README.md b/README.md index e2e288711..160824b97 100644 --- a/README.md +++ b/README.md @@ -337,7 +337,6 @@ terraform destroy | [asg\_delete\_timeout](#input\_asg\_delete\_timeout) | Timeout when trying to delete the Runner ASG. | `string` | `"10m"` | no | | [asg\_max\_instance\_lifetime](#input\_asg\_max\_instance\_lifetime) | The seconds before an instance is refreshed in the ASG. | `number` | `null` | no | | [aws\_region](#input\_aws\_region) | AWS region. | `string` | n/a | yes | -| [aws\_zone](#input\_aws\_zone) | Deprecated. Will be removed in the next major release. | `string` | `"a"` | no | | [cache\_bucket](#input\_cache\_bucket) | Configuration to control the creation of the cache bucket. By default the bucket will be created and used as shared cache. To use the same cache across multiple runners disable the creation of the cache and provide a policy and bucket name. See the public runner example for more details. | `map(any)` |
{
"bucket": "",
"create": true,
"policy": ""
}
| no | | [cache\_bucket\_name\_include\_account\_id](#input\_cache\_bucket\_name\_include\_account\_id) | Boolean to add current account ID to cache bucket name. | `bool` | `true` | no | | [cache\_bucket\_prefix](#input\_cache\_bucket\_prefix) | Prefix for s3 cache bucket name. | `string` | `""` | no | @@ -359,7 +358,6 @@ terraform destroy | [enable\_cloudwatch\_logging](#input\_enable\_cloudwatch\_logging) | Boolean used to enable or disable the CloudWatch logging. | `bool` | `true` | no | | [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 | | [enable\_eip](#input\_enable\_eip) | Enable the assignment of an EIP to the gitlab runner instance | `bool` | `false` | no | -| [enable\_forced\_updates](#input\_enable\_forced\_updates) | 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.` | `string` | `null` | no | | [enable\_gitlab\_runner\_ssh\_access](#input\_enable\_gitlab\_runner\_ssh\_access) | Enables SSH Access to the gitlab runner instance. | `bool` | `false` | no | | [enable\_kms](#input\_enable\_kms) | Let the module manage a KMS key, logs will be encrypted via KMS. Be-aware of the costs of an custom key. | `bool` | `false` | no | | [enable\_manage\_gitlab\_token](#input\_enable\_manage\_gitlab\_token) | Boolean to enable the management of the GitLab token in SSM. If `true` the token will be stored in SSM, which means the SSM property is a terraform managed resource. If `false` the Gitlab token will be stored in the SSM by the user-data script during creation of the the instance. However the SSM parameter is not managed by terraform and will remain in SSM after a `terraform destroy`. | `bool` | `true` | no | @@ -415,10 +413,6 @@ terraform destroy | [runners\_max\_builds](#input\_runners\_max\_builds) | Max builds for each runner after which it will be removed, will be used in the runner config.toml. By default set to 0, no maxBuilds will be set in the configuration. | `number` | `0` | no | | [runners\_monitoring](#input\_runners\_monitoring) | Enable detailed cloudwatch monitoring for spot instances. | `bool` | `false` | no | | [runners\_name](#input\_runners\_name) | Name of the runner, will be used in the runner config.toml. | `string` | n/a | yes | -| [runners\_off\_peak\_idle\_count](#input\_runners\_off\_peak\_idle\_count) | Deprecated, please use `runners_machine_autoscaling`. Off peak idle count of the runners, will be used in the runner config.toml. | `number` | `-1` | no | -| [runners\_off\_peak\_idle\_time](#input\_runners\_off\_peak\_idle\_time) | Deprecated, please use `runners_machine_autoscaling`. Off peak idle time of the runners, will be used in the runner config.toml. | `number` | `-1` | no | -| [runners\_off\_peak\_periods](#input\_runners\_off\_peak\_periods) | Deprecated, please use `runners_machine_autoscaling`. Off peak periods of the runners, will be used in the runner config.toml. | `string` | `null` | no | -| [runners\_off\_peak\_timezone](#input\_runners\_off\_peak\_timezone) | Deprecated, please use `runners_machine_autoscaling`. Off peak idle time zone of the runners, will be used in the runner config.toml. | `string` | `null` | no | | [runners\_output\_limit](#input\_runners\_output\_limit) | Sets the maximum build log size in kilobytes, by default set to 4096 (4MB) | `number` | `4096` | no | | [runners\_post\_build\_script](#input\_runners\_post\_build\_script) | Commands to be executed on the Runner just after executing the build, but before executing after\_script. | `string` | `"\"\""` | no | | [runners\_pre\_build\_script](#input\_runners\_pre\_build\_script) | Script to execute in the pipeline just before the build, will be used in the runner config.toml | `string` | `"\"\""` | no | diff --git a/examples/runner-default/main.tf b/examples/runner-default/main.tf index 6b027886c..7e80ec9a5 100644 --- a/examples/runner-default/main.tf +++ b/examples/runner-default/main.tf @@ -79,11 +79,6 @@ module "runner" { ] # working 9 to 5 :) - # Deprecated, replaced by runners_machine_autoscaling - # runners_off_peak_periods = "[\"* * 0-9,17-23 * * mon-fri *\", \"* * * * * sat,sun *\"]" - # runners_off_peak_timezone = var.timezone - # runners_off_peak_idle_count = 0 - # runners_off_peak_idle_time = 60 runners_machine_autoscaling = [ { periods = ["\"* * 0-9,17-23 * * mon-fri *\"", "\"* * * * * sat,sun *\""] diff --git a/examples/runner-pre-registered/main.tf b/examples/runner-pre-registered/main.tf index 941d02adb..2bf813b6a 100644 --- a/examples/runner-pre-registered/main.tf +++ b/examples/runner-pre-registered/main.tf @@ -46,10 +46,13 @@ module "runner" { runners_gitlab_url = var.gitlab_url runners_token = var.runner_token - runners_off_peak_timezone = var.timezone - runners_off_peak_idle_count = 0 - runners_off_peak_idle_time = 60 - # working 9 to 5 :) - runners_off_peak_periods = "[\"* * 0-9,17-23 * * mon-fri *\", \"* * * * * sat,sun *\"]" + runners_machine_autoscaling = [ + { + periods = ["\"* * 0-9,17-23 * * mon-fri *\"", "\"* * * * * sat,sun *\""] + idle_count = 0 + idle_time = 60 + timezone = var.timezone + } + ] } diff --git a/locals.tf b/locals.tf index 2ee465aa8..ed0b3a536 100644 --- a/locals.tf +++ b/locals.tf @@ -24,11 +24,4 @@ locals { runners_machine_autoscaling = var.runners_machine_autoscaling } ) - - // Depcrecated off peak, ensure not set if not explicit set. - runners_off_peak_periods_string = var.runners_off_peak_periods == null ? "" : format("OffPeakPeriods = %s", var.runners_off_peak_periods) - runners_off_peak_timezone = var.runners_off_peak_timezone == null ? "" : "OffPeakTimezone = \"${var.runners_off_peak_timezone}\"" - runners_off_peak_idle_count = var.runners_off_peak_idle_count == -1 ? "" : format("OffPeakIdleCount = %d", var.runners_off_peak_idle_count) - runners_off_peak_idle_time = var.runners_off_peak_idle_time == -1 ? "" : format("OffPeakIdleTime = %d", var.runners_off_peak_idle_time) - } diff --git a/main.tf b/main.tf index 612b8eb01..ddb0a45d5 100644 --- a/main.tf +++ b/main.tf @@ -50,8 +50,6 @@ resource "aws_ssm_parameter" "runner_sentry_dsn" { } locals { - enable_asg_recreation = var.enable_forced_updates != null ? !var.enable_forced_updates : var.enable_asg_recreation - template_user_data = templatefile("${path.module}/template/user-data.tpl", { eip = var.enable_eip ? local.template_eip : "" @@ -131,10 +129,6 @@ locals { runners_idle_count = var.runners_idle_count runners_idle_time = var.runners_idle_time runners_max_builds = local.runners_max_builds_string - runners_off_peak_timezone = local.runners_off_peak_timezone - runners_off_peak_idle_count = local.runners_off_peak_idle_count - runners_off_peak_idle_time = local.runners_off_peak_idle_time - runners_off_peak_periods_string = local.runners_off_peak_periods_string runners_machine_autoscaling = local.runners_machine_autoscaling runners_root_size = var.runners_root_size runners_iam_instance_profile_name = var.runners_iam_instance_profile_name @@ -171,7 +165,7 @@ data "aws_ami" "docker-machine" { } resource "aws_autoscaling_group" "gitlab_runner_instance" { - name = local.enable_asg_recreation ? "${aws_launch_template.gitlab_runner_instance.name}-asg" : "${var.environment}-as-group" + name = var.enable_asg_recreation ? "${aws_launch_template.gitlab_runner_instance.name}-asg" : "${var.environment}-as-group" vpc_zone_identifier = var.subnet_ids_gitlab_runner min_size = "1" max_size = "1" diff --git a/template/runner-config.tpl b/template/runner-config.tpl index 30aabd00f..402b44f43 100644 --- a/template/runner-config.tpl +++ b/template/runner-config.tpl @@ -62,8 +62,4 @@ sentry_dsn = "${sentry_dsn}" ${docker_machine_options} ] - ${runners_off_peak_timezone} - ${runners_off_peak_idle_count} - ${runners_off_peak_idle_time} - ${runners_off_peak_periods_string} ${runners_machine_autoscaling} diff --git a/variables.tf b/variables.tf index 97f1129f9..963194796 100644 --- a/variables.tf +++ b/variables.tf @@ -3,12 +3,6 @@ variable "aws_region" { type = string } -variable "aws_zone" { - description = "Deprecated. Will be removed in the next major release." - type = string - default = "a" -} - variable "arn_format" { type = string default = "arn:aws" @@ -231,30 +225,6 @@ variable "runners_ebs_optimized" { default = true } -variable "runners_off_peak_timezone" { - description = "Deprecated, please use `runners_machine_autoscaling`. Off peak idle time zone of the runners, will be used in the runner config.toml." - type = string - default = null -} - -variable "runners_off_peak_idle_count" { - description = "Deprecated, please use `runners_machine_autoscaling`. Off peak idle count of the runners, will be used in the runner config.toml." - type = number - default = -1 -} - -variable "runners_off_peak_idle_time" { - description = "Deprecated, please use `runners_machine_autoscaling`. Off peak idle time of the runners, will be used in the runner config.toml." - type = number - default = -1 -} - -variable "runners_off_peak_periods" { - description = "Deprecated, please use `runners_machine_autoscaling`. Off peak periods of the runners, will be used in the runner config.toml." - type = string - default = null -} - variable "runners_machine_autoscaling" { description = "Set autoscaling parameters based on periods, see https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnersmachine-section" type = list(object({ @@ -701,12 +671,6 @@ variable "asg_max_instance_lifetime" { type = number } -variable "enable_forced_updates" { - 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." - default = null - type = string -} - variable "permissions_boundary" { description = "Name of permissions boundary policy to attach to AWS IAM roles" default = ""