-platform_file="common-packer/vars/$PACKER_PLATFORM.json"
-if [[ -f "vars/$PACKER_PLATFORM.json" ]]; then
- platform_file="vars/$PACKER_PLATFORM.json"
+if version_ge "$PACKER_VERSION" "1.9.0"; then
+ platform_file="common-packer/vars/$PACKER_PLATFORM.pkrvars.hcl"
+ template_file="templates/$PACKER_TEMPLATE.pkr.hcl"
+ only="${PACKER_BUILDER}.${PACKER_TEMPLATE}"
+
+ if [[ -f "vars/$PACKER_PLATFORM.pkrvars.hcl" ]]; then
+ platform_file="vars/$PACKER_PLATFORM.pkrvars.hcl"
+ fi
+else
+ platform_file="common-packer/vars/$PACKER_PLATFORM.json"
+ template_file="templates/$PACKER_TEMPLATE.json"
+ only="${PACKER_BUILDER}"
+
+ if [[ -f "vars/$PACKER_PLATFORM.json" ]]; then
+ platform_file="vars/$PACKER_PLATFORM.json"
+ fi