在执行 terraform plan 输出以显示计划文件的内容时,如何指定计划文件?

How do I specify a plan file when doing terraform plan output to show the contents of a plan file?

我的计划文件以特定名称保存。我试过了 terraform plan planfilename.plan -out=tfplan 并显示包含计划文件名的其他变体

terraform plan -out=tfplan

标志“-out”用于指定输出文件名。所以在这种情况下,您的输出文件是“tfplan”。如果您想指定多个输出文件,无论出于何种原因,您都可以做一些奇怪的事情:

terraform plan -out=tfplan; cat tfplan > planefilename.plan

要将计划保存到您可以使用的位置:

terraform plan --out=<filename>

要检查此计划,您可以使用 show 命令:

terraform show <filename>

要应用此计划,您可以执行以下操作:

terraform apply <filename>