DRY

Moved Out
hold
First Added:January 5, 2025 Updated: July 29, 2026

DRY is a technique we hold in the garden.

Summary

Key points:

ContextGuidance
Application codeExtract when behavior and change rate align; keep tests on both call sites during migration
Terraform / OpenTofuPrefer small modules with clear inputs/outputs over one module that owns an entire account
Kubernetes / HelmSubcharts for real reuse; copy YAML when teams and lifecycles differ
PoliciesOne Rego/Sentinel bundle per concern; do not merge unrelated checks for line count
ReviewsAsk “what changes together?” not “how many times does this string appear?”

IaC-specific: minimizing blast radius beats minimizing bytes. Explicit duplication in two stacks is often safer than a shared module that forces unrelated environments to upgrade together.

When repetition is OK: similar HCL for dev and prod with intentional differences; two resources that look alike but have different owners or compliance tags; bootstrap code you expect to delete.

References

Details

ContextGuidance
Application codeExtract when behavior and change rate align; keep tests on both call sites during migration
Terraform / OpenTofuPrefer small modules with clear inputs/outputs over one module that owns an entire account
Kubernetes / HelmSubcharts for real reuse; copy YAML when teams and lifecycles differ
PoliciesOne Rego/Sentinel bundle per concern; do not merge unrelated checks for line count
ReviewsAsk “what changes together?” not “how many times does this string appear?”

IaC-specific: minimizing blast radius beats minimizing bytes. Explicit duplication in two stacks is often safer than a shared module that forces unrelated environments to upgrade together.

When repetition is OK: similar HCL for dev and prod with intentional differences; two resources that look alike but have different owners or compliance tags; bootstrap code you expect to delete.

References