Packer 如何将 JSON 的配置升级为 HCL2

在新版本的 Packer 中,如果你需要创建服务器的镜像的话,推荐使用 HCL2 的配置文件。

如何将已有的 JSON 配置文件升级为 HCL2?

问题和解决

可以使用下面的命令来进行升级。

packer hcl2_upgrade -with-annotations druid-historical.json

在升级完成后,将会在当前 JSON 文件同一个文件夹中创建一个 druid-historical.json.pkr.hcl 文件。

这个文件就是升级后的文件了。

上面的文件显示的是使用 HCL2 语言来进行描述的配置文件。

控制台的输入如下:

D:WorkDirFacilityConneXSource-CodeCloudpacker>packer hcl2_upgrade -with-annotations druid-historical.json
Successfully created druid-historical.json.pkr.hcl

D:WorkDirFacilityConneXSource-CodeCloudpacker>

在控制台中,并不会给出一些具体的提示。

https://www.ossez.com/t/packer-json-hcl2/13511

原文地址:https://www.cnblogs.com/huyuchengus/p/14926522.html