Terraform scenarios to Reference Outputs from a Module in Another Module with Circular Dependency
I'm wondering if anyone has experience with I'm working on a Terraform setup where I have two modules: `module_a` and `module_b`. `module_a` outputs a value that `module_b` needs as an input. The scenario arises when I attempt to reference the output from `module_a` in `module_b`. I keep working with the behavior: `behavior: Cycle: module.module_a.module_a -> module.module_b.module_b -> module.module_a.module_a`. Here's a simplified version of my Terraform configuration: ```hcl module "module_a" { source = "./module_a" } module "module_b" { source = "./module_b" input_value = module.module_a.output_value } ``` In `module_a`, I have the following output defined: ```hcl output "output_value" { value = aws_s3_bucket.my_bucket.bucket } ``` And in `module_b`, I am expecting to use this output: ```hcl variable "input_value" { type = string } resource "aws_lambda_function" "my_lambda" { function_name = "my_lambda_function" s3_bucket = var.input_value } ``` The question seems to be a circular dependency, but I'm unsure how to resolve it without restructuring my modules entirely. I've tried re-ordering the module declarations, but that hasn’t helped. Is there a known best practice for handling outputs between modules that depend on each other, or is there a more appropriate way to refactor the code to avoid this circular dependency? The stack includes Hcl and several other technologies. Thanks in advance! What's the best practice here?