Open maistro-mw opened 2 years ago
Hi, @maistro-mw thanks for your feedback. i believe the schedule resource's start_time
property doesn't auto adjust the timezone part by the timezone
property of the resource. so you should use
start_time = "${substr(timeadd(timestamp(), "24h"), 0, 10)}T22:00:00+01:00"
for London summer time.
as for summertime, there is a gap between Terraform and the azure portal, terraform does not auto transfer the timezone so you have to change the summer time zone manually. I think it should be fixed by Terraform team, and I'll report it to the team.
Hi @wuxu92 thanks for your reply. I tried using +01:00 instead of Z but that still put the wrong time in unless I left the timezone property blank (thus defaulting to UTC). This removed the Timezone setting in the Azure resource which meant it would not cope with the summer time changes. It would be good if this could be addressed by the Terraform team - prior to that I will manually adjust my definition to result in the correct time being deployed.
prior
i have tried with this config
start_time = "${substr(timeadd(timestamp(), "24h"), 0, 10)}T21:00:00+01:00"
timezone = "Europe/London"
and the resource start_time looks fine
OK, thanks. I will try again - I was not getting the same result
@wuxu92 Thanks - that appears to get the correct time in now. Will see what happens when summer time ends as I guess I will need to change to +00:00 in my terraform config
I think the best option here would be to completely ignore time-offset in favour of timezone if specified.
There is a solution for this on SO: https://stackoverflow.com/questions/61762648/terraform-azurerm-schedule-start-time-always-resets-on-new-deploys
Hi @wuxu92,
I have the same problem. I'm trying to set schedule in local time (fixed)
start_time = "2023-11-23T18:20:31Z"
timezone = "Europe/Warsaw"
and in portal I have:
When I do it in portal I'm entering local time, so I think the is some calculation of start_time and timezone.
Can it be fixed?
Hi @MichalSino ,
This is because the provider will process the start_time
to location of time_zone
, as "2023-11-23T18:20:31Z"
will be processed as 2023-11-23T19:20:31+01:00
. So if you want set it in local time, you can use
start_time = "2023-11-23T18:20:31+01:00"
timezone = "Europe/Warsaw"
Ok, I understand.
But that's why I ask to possibility of changing it, because I need to remember if there is summer time or winter time. If it were not be calculated and writed the same as I entered, it would be better. Do you know it is done in api side or in provider side?
I don't really understand why accept tz database timezone
input but actually require a tz-aware RFC3339 input in start_time
..
I don't really understand why accept tz database timezone input but actually require a tz-aware RFC3339 input in start_time..
This is also confusing me. What is the point of the timezone then???
Agreed, if you do it in the portal the time is set correctly with the timezone, but via terraform you get a totally different time when using timezone and start_time.
Is there an existing issue for this?
Community Note
Terraform Version
1.2
AzureRM Provider Version
3.13.0
Affected Resource(s)/Data Source(s)
azurerm_automation_schedule
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
The schedule is entered as T22:00Z with timezone Europe/London, so I expect the schedule to be created for 10pm in the UK timezone (which currently is summer time so UTC+1). The expected behaviour (which would occur is manually creating in Azure) would be for the schedule to run at 10pm - observing the summer time changes - so it is always at 10pm.
Actual Behaviour
The schedule is created as 11pm in the UK timezone. The apply operation is adding the +1 but keeping the timezone setting. This means the schedule will run at 11pm in the summer time but if I were to run the apply again out of summer time it would reset to 10pm.
Steps to Reproduce
No response
Important Factoids
No response
References
No response