like:
- folderA
- vpcA.tf
- peering_connection.tf
- terraform.tfstate
- folderB
- vpcB.tf
- terraform.tfstate
I need vpc id of vpcB to set in peering_connection in folderA, Now I
can only just hard coding vpcB id in that file. How to solve this situation?
Thank you for your time.
data "terraform_remote_state" "folderB" {
backend = "local"
config {
path = "${path.module}/../folderB/terraform.tfstate"
}
}
you can now reference like this: data.terraform_remote_state.folderB.vpc_id
Ensure you output the vpc_id
Oh, awesome, thank you very much
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
you can now reference like this: data.terraform_remote_state.folderB.vpc_id
Ensure you output the vpc_id