Hi Team,
Unable to adjust the schedules priority order inside as rule using terraform. we can only adjust using manually.
We need support to set the order priority of scheduled inside a rule as well.
Sample terraform code rule with 4 schedules. these 4 schedules are added randomly.
Please refer attached tf file for used terraform code for rule with 4 schedules without priority.
resource "harness_autostopping_rule_vm" "aws_vm" {
name = "cpms-aws-ec2-01-us-work-hours1"
cloud_connector_id = var.cloud_connector_id
idle_time_mins = 5
filter {
vm_ids = [
"i-xxx"
]
regions = [
"us-east-2"
]
}
dry_run = false
}
Priorities test
resource "harness_autostopping_schedule" "MondayThroughFridayUptimeFrom9amTo6pm_vm" {
name = "MondayThroughFridayUptimeFrom9amTo6pm_vm"
schedule_type = "uptime"
time_zone = "EST"
starting_from = "2025-01-02 15:04:05"
repeats {
days = ["MON", "TUE", "WED", "THU", "FRI"]
start_time = "21:46"
end_time = "22:00"
}
rules = concat([
harness_autostopping_rule_vm.aws_vm.id
harness_autostopping_rule_rds.aws_rds.id,
harness_autostopping_rule_scale_group.aws_asg.id
])
}
resource "harness_autostopping_schedule" "twopmto3pmDowntimeOnWeekDays" {
name = "twopmto3pmDowntimeOnWeekDays_2"
schedule_type = "downtime"
time_zone = "EST"
starting_from = "2025-01-02 15:04:05"
repeats {
days = ["MON", "TUE", "WED", "THU", "FRI"]
start_time = "14:01"
end_time = "15:00"
}
rules = concat([
harness_autostopping_rule_vm.aws_vm.id
harness_autostopping_rule_rds.aws_rds.id,
harness_autostopping_rule_scale_group.aws_asg.id
])
}
resource "harness_autostopping_schedule" "OverNightDowntimeOnWeekDays" {
name = "OverNightDowntimeOnWeekDays_3"
schedule_type = "downtime"
time_zone = "EST"
starting_from = "2026-01-02 15:04:05"
repeats {
days = ["MON", "TUE", "WED", "THU", "FRI"]
start_time = "17:02"
end_time = "18:00"
}
rules = concat([
harness_autostopping_rule_vm.aws_vm.id
harness_autostopping_rule_rds.aws_rds.id,
harness_autostopping_rule_scale_group.aws_asg.id
])
}
resource "harness_autostopping_schedule" "CompleteDownTimeOnWeekEnd" {
name = "CompleteDownTimeOnWeekEnd_4"
schedule_type = "downtime"
time_zone = "EST"
starting_from = "2025-01-03 15:04:05"
repeats {
days = ["SUN", "SAT"]
}
rules = concat([
harness_autostopping_rule_vm.aws_vm.id
harness_autostopping_rule_rds.aws_rds.id,
harness_autostopping_rule_scale_group.aws_asg.id
])
}