A practitioner defines a child module named 'network' and wants the root configuration to reference the ID of a VPC that the module creates. The module already declares an output called 'vpc_id'. Which expression should the root configuration use to read that value?
module "network" {
source = "./modules/network"
cidr = "10.0.0.0/16"
}- Amodule.network.outputs.vpc_id
- Bvar.network.vpc_id
- Cnetwork.vpc_id
- Dmodule.network.vpc_id Correct
Why A is wrong: This looks plausible because outputs are what is being read, but Terraform does not insert an 'outputs' segment into the reference address, so it fails to resolve.
Why B is wrong: The var prefix reads input variables of the current module, not values exported by a child module, so it cannot reach the module's output.
Why C is wrong: Omitting the module keyword makes this look like a resource reference, but a bare name without the module prefix does not address a called module's output.
Why D is correct: A child module's exported output is read with the syntax module.<NAME>.<OUTPUT>, so module.network.vpc_id returns the value the module exposed.