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!
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.