terraform setting time with timezone

Viewed 2088

I need to define a TERRAFORM timestamp variable on a defined timezone.

All our business process are scheduled on Europe/Paris timezone. This timezone oscillates between GMT+1 and GMT+2 during the 4 seasons.

How can I set my timestamp() variable on this timezone?

2 Answers

Terraform's timestamp-manipulation functions are intended for producing machine-readable timestamps in various formats, not for human-oriented timestamps. Therefore there are no built-in functions for converting to and from local ("wallclock") time.

The formatdate function is able to accept a timestamp containing a UTC offset and include that offset in its output, but Terraform has no built-in way to generate such a timestamp: the timestamp function always returns a UTC timestamp and there is no way to customize that. Also, UTC offsets are not the same thing as timezones because, as you've noted, timezones include daylight savings rules which cause the offsets to be different at different times of year.

If you wish to reinterpret Terraform's timestamps in your local timezone then you will need to do that outside of Terraform.

Related