Hey,
Here is my framework
Environments
—dev
------main.tf
—stage
------main.tf
VPC
------main.tf
------variables.tf
------outputs.tf
VPC Module is like below and Used Outputs to VPC_ID
resource “aws_vpc” “vpc” {
}
Environments–>Dev–.>Main.tf is like create VPC
module “vpc” {
source = “…/…/vpc/”
}
My requirement over here, I needed to pass DEV ENV VPC ID to STAGE ENV to establish VPC Peering.
If its the same environment or main.tf means, i’m using below to get id, but is there any way to get passed this VPC_ID dynamically in any another environment like Stage?
“${module.vpc.vpc_id}”
It would be grate if you could share any sample example or code, pretty much appreciated.
Thank you so much for your time and kind favor,
Bala