• HashiCorp Developer

  • HashiCorp Cloud Platform
  • Terraform
  • Packer
  • Consul
  • Vault
  • Boundary
  • Nomad
  • Waypoint
  • Vagrant
Packer
  • Install
  • Tutorials
  • Documentation
  • Guides
  • Plugins
  • Try Cloud(opens in new tab)
  • Sign up
Packer Home

Documentation

Skip to main content
  • Documentation
  • HCP Packer

  • Terminology
    • Overview
      • Overview
        • Overview
          • formatdate
          • timeadd
          • timestamp
          • legacy_isotime
          • legacy_strftime
      • Variables
      • Locals
      • Contextual Variables
      • Data Sources
      • Path Variables
      • Syntax
      • Only Except
      • Expressions
      • JSON Syntax


  • Installing Packer
  • Configuring Packer

  • Integration Program

  • Debugging

  • Resources

  • Tutorial Library
  • Community Forum
    (opens in new tab)
  • Support
    (opens in new tab)
  • GitHub
    (opens in new tab)
  1. Developer
  2. Packer
  3. Documentation
  4. Templates
  5. HCL Templates
  6. Functions
  7. Date and Time Functions
  8. timestamp
  • Packer
  • v1.7.x
  • v1.6.x
  • v1.5.x

ยปtimestamp Function

timestamp returns the current date and time.

In the Packer language, timestamps are conventionally represented as strings using RFC 3339 "Date and Time format" syntax, and so timestamp returns a string in this format.

The result of this function will change every second, so using this function directly with resource attributes will cause a diff to be detected on every Packer run.

Breaking change note: Packer previously let you decide your own "Date and Time format" syntax. With HCL2 and for parity with Terraform, Packer will be using the RFC 3339 "Date and Time format" syntax. As a string. formatdate still allows you to format a date.

Examples

> timestamp()
2018-05-13T07:44:12Z

Related Functions

  • formatdate can convert the resulting timestamp to other date and time formats.
Edit this page on GitHub

On this page

  1. timestamp Function
  2. Examples
  3. Related Functions
Give Feedback(opens in new tab)
  • Certifications
  • System Status
  • Terms of Use
  • Security
  • Privacy
  • Trademark Policy
  • Trade Controls
  • Give Feedback(opens in new tab)