Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customisable cron expression for bastion scale up/down schedules #276

Merged
merged 8 commits into from
Oct 18, 2023
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ In order to prevent older versions from being retained forever, in addition to t
|------|-------------|------|---------|:--------:|
| <a name="input_allow_ssh_commands"></a> [allow\_ssh\_commands](#input\_allow\_ssh\_commands) | Allow SSH commands to be specified | `bool` | n/a | yes |
| <a name="input_app_name"></a> [app\_name](#input\_app\_name) | Name of application | `string` | n/a | yes |
| <a name="input_autoscaling_cron"></a> [autoscaling\_cron](#input\_autoscaling\_cron) | Cron expressions for scale up and scale down | `map(string)` | <pre>{<br> "down": "0 20 * * *",<br> "up": "0 5 * * *"<br>}</pre> | no |
| <a name="input_bucket_force_destroy"></a> [bucket\_force\_destroy](#input\_bucket\_force\_destroy) | The bucket and all objects should be destroyed when using true | `bool` | n/a | yes |
| <a name="input_bucket_name"></a> [bucket\_name](#input\_bucket\_name) | Bucket used for bucket log storage and user public keys | `string` | n/a | yes |
| <a name="input_bucket_versioning"></a> [bucket\_versioning](#input\_bucket\_versioning) | Enable bucket versioning or not | `bool` | n/a | yes |
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ resource "aws_autoscaling_schedule" "bastion_linux_scale_down" {
min_size = 0
max_size = 0
desired_capacity = 0
recurrence = "0 20 * * *" # 20.00 UTC time or 21.00 London time
recurrence = var.autoscaling_cron["up"]
autoscaling_group_name = aws_autoscaling_group.bastion_linux_daily.name
}

Expand All @@ -500,6 +500,6 @@ resource "aws_autoscaling_schedule" "bastion_linux_scale_up" {
min_size = 1
max_size = 1
desired_capacity = 1
recurrence = "0 5 * * *" # 5.00 UTC time or 6.00 London time
recurrence = var.autoscaling_cron["down"]
autoscaling_group_name = aws_autoscaling_group.bastion_linux_daily.name
}
8 changes: 8 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,11 @@ variable "tags_prefix" {
description = "prefix for name tags"
type = string
}
variable "autoscaling_cron" {
description = "Cron expressions for scale up and scale down"
type = map(string)
default = {
"up" = "0 5 * * *" # 5.00 UTC or 6.00 BST
"down" = "0 20 * * *" # 20.00 UTC or 21.00 BST
}
}