如何在 Terraform Apply 命令中提供 .tf 文件作为输入? [英] How to give a .tf file as input in Terraform Apply command?
本文介绍了如何在 Terraform Apply 命令中提供 .tf 文件作为输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是 Terraform 的初学者.
I'm a beginner in Terraform.
我有一个包含 2 个 .tf 文件的目录.
I have a directory which contains 2 .tf files.
现在我想在选定的 .tf 文件上运行 Terraform 应用 &忽略另一个.
Now I want to run Terraform Apply on a selected .tf file & neglect the other one.
我可以这样做吗?如果是,如何?如果不是,为什么&最佳做法是什么?
Can I do that? If yes, how? If no, why & what is the best practice?
推荐答案
您不能选择性地应用一个文件,然后再应用另一个.(也许)实现您的目标的两种方法:
You can't selectively apply one file and then the other. Two ways of (maybe) achieving what you're going for:
- 使用
-target
标记一个文件中的目标资源,然后是另一个文件. - 将每个文件(或更广泛地说,一组资源,可能是多个文件)放在单独的模块"(文件夹)中.然后,您可以分别
应用
它们.
这篇关于如何在 Terraform Apply 命令中提供 .tf 文件作为输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文