diff --git a/command/test-fixtures/hcl2_upgrade/complete-variables-with-template-engine/expected.pkr.hcl b/command/test-fixtures/hcl2_upgrade/complete-variables-with-template-engine/expected.pkr.hcl index 1116310d6..1bf776b6f 100644 --- a/command/test-fixtures/hcl2_upgrade/complete-variables-with-template-engine/expected.pkr.hcl +++ b/command/test-fixtures/hcl2_upgrade/complete-variables-with-template-engine/expected.pkr.hcl @@ -5,6 +5,7 @@ variable "env_test" { } locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") } +# The "legacy_isotime" function has been provided for backwards compatability, but we recommend switching to the timestamp and formatdate functions. # 5 errors occurred upgrading the following block: # unhandled "lower" call: @@ -33,7 +34,7 @@ locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") } # Visit https://www.packer.io/docs/templates/hcl_templates/functions/string/upper for more infos. locals { build_timestamp = "${local.timestamp}" - iso_datetime = "${local.timestamp}" + iso_datetime = "${legacy_isotime("2006-01-02T15:04:05Z07:00")}" lower = "{{ lower `HELLO` }}" pwd = "${path.cwd}" replace = "{{ replace `b` `c` `ababa` 2 }}" diff --git a/command/test-fixtures/hcl2_upgrade/complete/expected.pkr.hcl b/command/test-fixtures/hcl2_upgrade/complete/expected.pkr.hcl index 67e127138..3f1a46150 100644 --- a/command/test-fixtures/hcl2_upgrade/complete/expected.pkr.hcl +++ b/command/test-fixtures/hcl2_upgrade/complete/expected.pkr.hcl @@ -198,7 +198,7 @@ build { # Please manually upgrade to use custom validation rules, `replace(string, substring, replacement)` or `regex_replace(string, substring, replacement)` # Visit https://packer.io/docs/templates/hcl_templates/variables#custom-validation-rules , https://www.packer.io/docs/templates/hcl_templates/functions/string/replace or https://www.packer.io/docs/templates/hcl_templates/functions/string/regex_replace for more infos. provisioner "shell" { - inline = ["echo mybuild-{{ clean_resource_name `${local.timestamp}` }}"] + inline = ["echo mybuild-{{ clean_resource_name `${timestamp()}` }}"] } diff --git a/command/test-fixtures/hcl2_upgrade/without-annotations/expected.pkr.hcl b/command/test-fixtures/hcl2_upgrade/without-annotations/expected.pkr.hcl index 93c51bdc4..e332c21e0 100644 --- a/command/test-fixtures/hcl2_upgrade/without-annotations/expected.pkr.hcl +++ b/command/test-fixtures/hcl2_upgrade/without-annotations/expected.pkr.hcl @@ -151,7 +151,7 @@ build { # Please manually upgrade to use custom validation rules, `replace(string, substring, replacement)` or `regex_replace(string, substring, replacement)` # Visit https://packer.io/docs/templates/hcl_templates/variables#custom-validation-rules , https://www.packer.io/docs/templates/hcl_templates/functions/string/replace or https://www.packer.io/docs/templates/hcl_templates/functions/string/regex_replace for more infos. provisioner "shell" { - inline = ["echo mybuild-{{ clean_resource_name `${local.timestamp}` }}"] + inline = ["echo mybuild-{{ clean_resource_name `${timestamp()}` }}"] }