A team wants to tweak a resource inside your module that you didn't expose. What are the options?
IntermediateScenarioModules and Code Structure
Answer
Situation read → Pressure to fork or hack a shared module.
What I'd do →
- Ask whether it's a legitimate, general need; if yes, add a variable and release a minor version.
- If it's team-specific, create the extra resource outside the module using the module's outputs.
- Do not use
override.tffiles or copy the module.
Why → Forks drift away from upstream and miss fixes; extending through outputs keeps one source of truth.
Interview tip → Good modules output IDs and ARNs of their key resources for exactly this reason.
More on Modules and Code Structure
When do you turn a block of resources into a module, and when do you leave it alone?BeginnerHow do you consume a community module like `terraform-aws-modules/vpc/aws` responsibly?BeginnerAn ECS service module needs the VPC and subnets created by a network module. How do you wire them together?IntermediateHow would you lay out a repo that deploys the same stack to dev, stage and prod?IntermediateHow do you release a shared module so consumers can upgrade at their own pace?IntermediateA module needs to deploy to a second region. Why does putting a provider block inside the module cause trouble?Advanced