将文件传递给Terraform模块 [英] Pass files to Terraform modules
本文介绍了将文件传递给Terraform模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Terraform模块。所有环境都使用它。
I have a single Terraform module. This is used by all environments.
我想要的是传递特定于每个环境的单个文件,例如NSG规则(带有自己的IP /等),供模块使用和使用。
What I'd like is to pass individual files specific to each environment such as NSG rules (with their own IP / etc) for the module to use and deploy with.
部署模块,但传入多个特定于环境的参数/变量/模板以与模块一起部署。
So a single module, but multiple environment-specific parameters/variables/templates are passed in to be deployed with the module.
有什么建议吗?
Chris
推荐答案
问候,
感谢您在这里发帖。
我们可以实现这有两种方式,
1.通过在模块内部安排文件夹结构并根据环境分离变量文件。
2.使用Terraform工作区温泉n>
通常,terraform模块的最小和完整模块结构如下所示,
最小结构:
树最小模块/
。
├──README.md
├──main.tf
├──variable.tf
├──insput.tf
这篇关于将文件传递给Terraform模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文