Skip to content

Commit 6b35a10

Browse files
skeith45David Larin
and
David Larin
authored
fix: autoscaling configuraton (#301)
* fix object based auto-scaling configuration * add backward compatibility Co-authored-by: David Larin <[email protected]>
1 parent f60c9d5 commit 6b35a10

File tree

5 files changed

+54
-10
lines changed

5 files changed

+54
-10
lines changed

README.md

+35-4
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,38 @@ terraform destroy
251251
| aws | n/a |
252252
| null | n/a |
253253

254+
## Modules
255+
256+
| Name | Source | Version |
257+
|------|--------|---------|
258+
| cache | ./modules/cache | |
259+
260+
## Resources
261+
262+
| Name |
263+
|------|
264+
| [aws_ami](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ami) |
265+
| [aws_autoscaling_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_group) |
266+
| [aws_autoscaling_schedule](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_schedule) |
267+
| [aws_availability_zone](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zone) |
268+
| [aws_caller_identity](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) |
269+
| [aws_cloudwatch_log_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) |
270+
| [aws_eip](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eip) |
271+
| [aws_iam_instance_profile](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_instance_profile) |
272+
| [aws_iam_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) |
273+
| [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) |
274+
| [aws_iam_role_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy) |
275+
| [aws_iam_role_policy_attachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) |
276+
| [aws_kms_alias](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_alias) |
277+
| [aws_kms_key](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key) |
278+
| [aws_launch_configuration](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/launch_configuration) |
279+
| [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) |
280+
| [aws_security_group_rule](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) |
281+
| [aws_ssm_parameter](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_parameter) |
282+
| [aws_subnet](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet) |
283+
| [null_data_source](https://registry.terraform.io/providers/hashicorp/null/latest/docs/data-sources/data_source) |
284+
| [null_resource](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) |
285+
254286
## Inputs
255287

256288
| Name | Description | Type | Default | Required |
@@ -332,8 +364,8 @@ terraform destroy
332364
| 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 |
333365
| runners\_monitoring | Enable detailed cloudwatch monitoring for spot instances. | `bool` | `false` | no |
334366
| runners\_name | Name of the runner, will be used in the runner config.toml. | `string` | n/a | yes |
335-
| 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. | `string` | `-1` | no |
336-
| 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. | `string` | `-1` | no |
367+
| 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 |
368+
| 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 |
337369
| 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 |
338370
| 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 |
339371
| runners\_output\_limit | Sets the maximum build log size in kilobytes, by default set to 4096 (4MB) | `number` | `4096` | no |
@@ -374,7 +406,6 @@ terraform destroy
374406
| runner\_role\_arn | ARN of the role used for the docker machine runners. |
375407
| runner\_role\_name | Name of the role used for the docker machine runners. |
376408
| runner\_sg\_id | ID of the security group attached to the docker machine runners. |
377-
378409
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
379410

380411
## Contributors ✨
@@ -385,4 +416,4 @@ This project exists thanks to all the people who contribute.
385416
<img src="https://contrib.rocks/image?repo=npalm/terraform-aws-gitlab-runner" />
386417
</a>
387418

388-
Made with [contributors-img](https://contrib.rocks).
419+
Made with [contributors-img](https://contrib.rocks).

modules/cache/README.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ module "runner" {
3838
| aws | n/a |
3939
| random | n/a |
4040

41+
## Modules
42+
43+
No Modules.
44+
45+
## Resources
46+
47+
| Name |
48+
|------|
49+
| [aws_caller_identity](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) |
50+
| [aws_iam_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) |
51+
| [aws_s3_bucket](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) |
52+
| [aws_s3_bucket_public_access_block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) |
53+
| [random_string](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string) |
54+
4155
## Inputs
4256

4357
| Name | Description | Type | Default | Required |
@@ -61,5 +75,4 @@ module "runner" {
6175
| arn | The ARN of the created bucket. |
6276
| bucket | Name of the created bucket. |
6377
| policy\_arn | Policy for users of the cache (bucket). |
64-
6578
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

template/runner-config.tpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ check_interval = 0
6565
${runners_off_peak_idle_count}
6666
${runners_off_peak_idle_time}
6767
${runners_off_peak_periods_string}
68-
${runners_machine_autoscaling}
68+
${runners_machine_autoscaling}

template/runners_machine_autoscaling.tpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
%{ for config in runners_machine_autoscaling ~}
2-
[[runners.machine.autoscaling]]
3-
Periods = [${join(",", config.periods)}]
2+
[[runners.machine.autoscaling]]
3+
Periods = [${replace(format("\"%s\"", join("\",\"", config.periods)), "/\"{2,}/", "\"")}]
44
IdleCount = ${config.idle_count}
55
IdleTime = ${config.idle_time}
66
Timezone = "${config.timezone}"

variables.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,13 @@ variable "runners_off_peak_timezone" {
209209

210210
variable "runners_off_peak_idle_count" {
211211
description = "Deprecated, please use `runners_machine_autoscaling`. Off peak idle count of the runners, will be used in the runner config.toml."
212-
type = string
212+
type = number
213213
default = -1
214214
}
215215

216216
variable "runners_off_peak_idle_time" {
217217
description = "Deprecated, please use `runners_machine_autoscaling`. Off peak idle time of the runners, will be used in the runner config.toml."
218-
type = string
218+
type = number
219219
default = -1
220220
}
221221

0 commit comments

Comments
 (0)