Add time_static attribute with time zone capabilities
OmerLaza opened this issue ยท 3 comments
Community Note
- Please vote on this issue by adding a
๐ reaction to the original issue to help the community and maintainers prioritize this request - Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
Hey, I've stated using basic TF and I've found the time_static
very useful for timestamping resources creation time. We want to be able to timestamp our resources in timestamp that reflects our time zone (and not UTC).
So we want a time zone attribute for time_static
similar to .rfc3339
but with option to add time zone to affect the output.
New or Affected Resource(s)
time_static
time zone sensitive attribute.
Potential Terraform Configuration
resource "time_static" "createion_timestamp" {
time_zone = "CET"
}
locals {
common_tags {
CreationDateTime = time_static.createion_timestamp.time_with_timezone
}
}
References
https://en.wikipedia.org/wiki/List_of_time_zone_abbreviations - list of time zone abbreviations
Hi @OmerLaza
On the surface this may seem like a relatively straightforward problem, however timezones and associated data changes are actually a quite complex topic. For example, daylight savings times are regularly updated, there have been recent format changes to the underlying tzdata files used in some implementations, and often accessing this information is best through the platform specific implement of the execution environment rather than a purely programming language specific implementation. There is a lot of machinery behind the scenes managed by today's Operating System and programming language maintainers to keep the information up-to-date and valid.
All this is not to say that we would not consider anything in this space, it is just a complex area that might require additional design, implementation, and binary release work (e.g. enabling CGO on all platforms).
As a workaround for now, you may find pairing the timeadd()
function with the formatdate()
function (to hardcode the timezone format) acceptable. It will not be the prettiest solution, but hopefully something like that might get you going for now until further movement can be made on our end to make decisions about this.
Hi again, @OmerLaza timeadd()
and formatdate()
functions in this situation should provide the necessary configuration to accomplish timezone handling.
^^ As I cannot reopen this request, I've logged #163