Skip to content

bug: Terraform provider fails to validate timezones in minimal container environments #470

@uzair-coder07

Description

@uzair-coder07

Description

The Terraform provider validates timezones using time.LoadLocation() but doesn't embed the timezone database (time/tzdata). This causes timezone validation to fail in minimal containers or environments that don't have system tzdata installed.

Root Cause

The main Coder binary embeds tzdata via _ "time/tzdata" import, but the Terraform provider does not include this import. This causes the coder templates push command to fail with the following:

2025-12-01 12:57:53.234-06:00 Error: failed to load timezone "America/New_York": unknown time zone America/New_York Encountered an error running "coder templates push", see "coder templates push --help" for more information error: template import provision for start: terraform plan: exit status 1

Workarounds

  1. Install the tzdata package in your provisioner environment:
  • Debian/Ubuntu: apt-get install tzdata
  • Alpine: apk add tzdata
  1. Use UTC as the timezone (always available regardless of environment)

Proposed Fix

Add the tzdata embed import to the Terraform provider's main.go:

import (
    _ "time/tzdata"
)

The _ "time/tzdata" import embeds the IANA Time Zone database directly into the compiled binary. This means time.LoadLocation() will have access to all timezone definitions regardless of whether the host system has tzdata installed. This is also consistent with how the main Coder binary handles it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions