Open flostadler opened 2 months ago
Voting for Prioritization
Volunteering to Work on This Issue
There is a bug when we use the autoscaling_schedule.recurrence property. You can't remove it once TF set it.
When you set it then terraform apply
, it works :
recurrence = "0 7 * * 1-5"
But when you remove it then then terraform plan or apply
the recurrence is still defined in the AWS console
# recurrence = "0 7 * * 1-5"
You can update it to something else but you can't remove it :
recurrence = "0 8 * * 1-5"
Terraform Core Version
1.5.7
AWS Provider Version
5.63.1
Affected Resource(s)
Expected Behavior
When creating a
aws_autoscaling_schedule
without start_time, AWS will calculate an appropriate start time based on therecurrence
.On subsequent modifications of the resource, the start_time shouldn't be sent in the API requests in order to trigger the re-computation again.
Actual Behavior
When the schedule is created, the computed start_time is saved to state and subsequent modifications will include this start_time in their API requests.
This can lead to scenarios where the schedule does not fire when expected or the modification fails because AWS whether the start time is in the future.
For example: When creating a schedule without start_time and the following recurrence
0 10 * * SAT
(At 10:00 on Saturdays), the start_time will be set by AWS to the first occurrence of this cron job (e.g.2024-08-24T10:00:00Z
). If the recurrence is now modified to0 8 * * SAT
(At 08:00 on Saturdays), the start_time stays at2024-08-24T10:00:00Z
. This will have the effect that the schedule skips the first week.If the recurrence is now updated on a day after
2024-08-24T10:00:00Z
, AWS will fail the API request because the start_time is in the past and they do not allow that:ValidationError: Given start time is in the past
.Relevant Error/Panic Output Snippet
Terraform Configuration Files
Steps to Reproduce
terraform apply
: Observe the start_time output being set to next Saturday at 10:00terraform apply -var="recurrence=0 8 * * SAT"
: Observe the start_time output still being set to next Saturday 10:00, while in reality it should be 08:00Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None