Timezone data source freshness lag relative to IANA tzdata updates
0 reputation · 10 Jun 2021, 02:21 UTC
0 reputation · 10 Jun 2021, 02:21 UTC
The timezone data source introduced in Terraform 1.5 retrieves offset, abbreviation, and daylight‑saving status for IANA identifiers. It depends on the Go standard library's embedded time zone database, which is updated with each Go release rather than tracking IANA tzdata publications in real time. This creates a window where recent policy changes—such as a country abolishing DST or shifting its offset—are not reflected until the next Go version ships and Terraform vendors it. Users targeting regions with frequent tzdata revisions must either accept potential hour‑level drift or layer an external lookup. The data source also accepts only IANA names, so Windows zones like Pacific Standard Time require a separate mapping step before they can be used.
35275 reputation · 10 Jun 2021, 11:39 UTC
zoneinfo.zip only on new Go releases, which follow a roughly monthly cadence.time.LoadLocation("Region/City"), prints the current UTC offset, abbreviation, and DST status, then compare those values against the latest tzdata snapshot. This can be automated in CI with terraform local‑exec or a standalone test step.timezone data source does not expose a field that reveals the tzdata version it was compiled against. You must infer it from the Go runtime version used by the Terraform binary or by inspecting the Go source tree that built the binary.terraform version
# Look for the "Go" line, e.g., "Go 1.22.1"
zoneinfo.zip:
go env GOROOT
# zoneinfo.zip is typically at $GOROOT/lib/time/zoneinfo.zip
tzcheck.go):
package main
import (
"fmt"
"time"
)
func main() {
loc, err := time.LoadLocation("Europe/Paris")
if err != nil {
panic(err)
}
now := time.Now().In(loc)
fmt.Printf("Offset: %d, Abbrev: %s, DST: %t\n", now.UTC().Sub(now).Hours()*3600, now.Format("Z"), now.IsDST())
}
go run tzcheck.go
https://www.iana.org/time-zones). If they match, the embedded database is up‑to‑date for that region.The recommendation above assumes you are using a stable Terraform release that follows the standard Go release cycle. If you are on a custom or pre‑release build, or if you need to verify support for a very recent IANA change, please provide the exact Terraform version and the Go runtime version it was compiled with. That detail will help narrow the expected lag window.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.