hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
14.99k stars 3.32k forks source link

Set tag with isotime +30d #8878

Closed fmunteanu closed 4 years ago

fmunteanu commented 4 years ago

I want to create an AMI DeleteOn tag, using isotime:

"tags": {
    "DeleteOn": "{{isotime '2006-01-02'}}"
}

However, I would like to set the tag 30 days into future. Could you please help me figure what i the proper format?

azr commented 4 years ago

Hey @fmunteanu, thanks for opening, I was looking at the docs and it looks like it's not available in the JSON mode yet. I think it would be a valuable addition.

In HCL2 mode there's a timeadd functions though: https://packer.io/docs/configuration/from-1.5/functions/datetime/timeadd.html ( if you decide to update to HCL2 for this reason please bear in mind it's still in beta and being actively worked on, we don't expect any breaking changes though only additions )

fmunteanu commented 4 years ago

Hi @azr , I'm looking at the documentation and HCL2 is in beta. Do all JSON features are available in HCL2? https://github.com/hashicorp/hcl https://packer.io/guides/hcl/from-json-v1

azr commented 4 years ago

Not all features, like for now only the build command is available and there are some things we want to fix/do. The list can be found here: https://github.com/hashicorp/packer/labels/hcl2 ( watch out some fixes/features of this link are closed and will be available for the next release )

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.