我已经保存了terraform plan -out=my-plan
,并打算将其保存到源代码管理中,并进一步注入(inject)到自定义工具中以进行摄取和执行测试等。
但是,my-plan
的文件内容很困惑,我想知道使用的编码是什么。
Terraform 计划文件使用的编码是什么?
最佳答案
虽然此处提到的其他工具很有用,但 Terraform 空间中的情况经常发生变化,并且第三方工具通常无法保持最新状态。
一段时间以来,Terraform 直接支持以与运行 plan
时显示的相同的人类可读格式查看计划文件:
terraform show <filename>
从 v0.12 开始,您现在还可以查看 JSON 格式的计划文件,您可以保存该文件以便使用其他工具进一步处理:
terraform show -json <filename>
https://www.terraform.io/docs/internals/json-format.html 有 JSON 模式的解释。截至撰写本文时,请注意:
The output ... currently has major version zero to indicate that the format is experimental and subject to change. A future version will assign a non-zero major version ... We do not anticipate any significant breaking changes to the format before its first major version, however.
关于Terraform 计划输出 : what is the encoding being used,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49385346/