Terraform

You noticed your Terraform code includes quite a lot of hardcoded values (like ports, subnets, ...) and they are duplicated in many locations. How'd you deal with it?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

Using variables might not be a good solution because some things shouldn't be exposed and accidentally overridden. In such case you might want to use the concept of locals