4

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

 3 years ago
source link: https://segmentfault.com/a/1190000040232589
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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

发布于 50 分钟前

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

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

问题和解决

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

packer hcl2_upgrade -with-annotations druid-historical.json

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

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

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

控制台的输入如下:

D:\WorkDir\FacilityConneX\Source-Code\Cloud\packer>packer hcl2_upgrade -with-annotations druid-historical.json
Successfully created druid-historical.json.pkr.hcl

D:\WorkDir\FacilityConneX\Source-Code\Cloud\packer>

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

https://www.ossez.com/t/packe...


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK