using one terraform inventory into another terraform script

大憨熊 提交于 2020-01-07 02:53:08

问题


I am trying to write a seperate terraform script for aws cloudwatch alerts apart from creating aws instances, i want to use terraform inventory of different terraform script which will build aws instances.How to access the inventory of one terraform script and use it in the cloudwatch alerts terraform script?

Thank you!


回答1:


This is possible if you are using remote state. You will have to use root-level outputs to expose the values you want to be able to access from the second Terraform state (in your example, the aws_instance ids, most likely). You can then use the terraform_remote_state data source in your second terraform configuration to access those outputs.



来源:https://stackoverflow.com/questions/41003986/using-one-terraform-inventory-into-another-terraform-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!