• 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. legacy_isotime
  • Packer
  • v1.7.x
  • v1.6.x
  • v1.5.x

ยปlegacy_isotime Function

The legacy_isotime function returns the current date and time using the given format string. The format string follows Go's datetime formatting. See isotime-function-format-reference for more details.

This function has been provided to create backwards compatibility with Packer's legacy JSON templates. However, we recommend that you upgrade your HCL Packer template to use timestamp and formatdate together as soon as is convenient.

Note: If you are using a large number of builders, provisioners or post-processors, the isotime may be slightly different for each one because it is from when the plugin is launched not the initial Packer process. In order to avoid this and make the timestamp consistent across all plugins, set it as a user variable and then access the user variable within your plugins.

Examples

> legacy_isotime("2006-01-02")
2021-04-19

Related Functions

  • format is a more general formatting function for arbitrary data.
  • timestamp returns the current date and time in a format suitable for input to formatdate.
  • formatdate can convert the resulting timestamp to other date and time formats.
Edit this page on GitHub

On this page

  1. legacy_isotime 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)