Join our Newsletter — 33% off our NHI Course
Home FAQ Cyber Security What is the difference between using approved Terraform…
Cyber Security

What is the difference between using approved Terraform modules and creating resources directly in code?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated September 8, 2026 Domain: Cyber Security

Using approved modules creates a governed path for resource provisioning, while direct resource creation bypasses that control layer. Approved modules help standardise security settings, compliance checks, and repeatable patterns across teams. Direct use of raw resources can be faster in the moment, but it often produces inconsistent configurations, weaker guardrails, and higher review effort when the environment grows.

Approved Terraform Modules Create a Control Plane, Not Just a Shorter Path

The practical difference is not only speed or convenience. Approved modules give teams a governed interface for provisioning, so security defaults, naming standards, tagging, and review expectations are applied consistently. Direct resource creation pushes those decisions into each code path, which makes drift, exceptions, and inconsistent hardening more likely as the estate grows. For infrastructure teams, the real question is whether the provisioning method is enforcing policy before the resource exists or leaving every developer to reproduce that discipline manually.

That distinction matters because infrastructure code is also control logic. When teams bypass modules, they often bypass the shared assumptions that make reviewable and auditable infrastructure possible, including baseline configuration, logging expectations, and ownership metadata. NIST’s control families around configuration management and system security are directly relevant here, because the issue is not Terraform syntax itself but whether the provisioning process preserves standardisation and accountability. NIST SP 800-53 Rev 5 Security and Privacy Controls is useful for mapping those expectations to formal control outcomes. In practice, many teams only discover the cost of direct resource sprawl after exception handling and review burden have already become the norm.

How the Two Approaches Behave Once the Environment Scales

Approved modules work by collapsing common infrastructure decisions into a reusable pattern. A module can enforce secure defaults for network exposure, encryption settings, identity bindings, logging hooks, and naming conventions, while still allowing narrow inputs for the parts that genuinely need to vary. That makes the module the policy boundary: if a team wants an exception, it must usually be handled in the module design rather than scattered across dozens of individual resource definitions.

Direct resource creation in code can be appropriate for one-off experimentation, urgent fixes, or highly specialised resources that do not fit the standard pattern. The problem is that this approach shifts responsibility from the platform layer to each author. Once multiple teams begin writing their own versions of the same resource, the organisation loses consistency and review becomes harder because the control intent is encoded differently in every repository.

  • Approved modules reduce variance in security posture by making the safe path the easy path.
  • Direct resources increase local flexibility, but they also increase the chance of accidental divergence from baseline controls.
  • Modules improve auditability because reviewers can assess the pattern once, then inspect inputs rather than re-evaluating every implementation.
  • Raw resources can still be valid when the use case is genuinely unique, but they should be treated as exceptions, not the default design choice.

The operational trade-off is that modules add a dependency on module maintainers, versioning, and change management. If the module is poorly designed, teams may inherit hidden constraints or work around it unsafely. That is why governance has to focus on module quality, lifecycle ownership, and exception handling, not just whether a module exists at all. The guidance starts to break down when the module catalogue is stale, incomplete, or too rigid to represent legitimate platform variation.

When Module Governance Becomes More Important Than the Resource Type Itself

Tighter standardisation often reduces configuration risk, but it can also increase friction for specialist workloads, so organisations need to balance consistency against the operational cost of forcing every use case into one pattern. The key distinction is between justified variation and uncontrolled variance. A mature programme allows both, but it makes the exception explicit and reviewable.

There is also a practical difference between a module that merely wraps a resource and one that actually encodes guardrails. Only the second type meaningfully changes security posture. If the module exists only as a convenience wrapper, it may improve developer experience without materially improving compliance or hardening. In those cases, teams can get a false sense of governance while the underlying risk remains unchanged.

Another edge case is platform migration. During a transition, direct resource code may temporarily coexist with approved modules, especially where legacy systems cannot be refactored quickly. That is acceptable only when ownership, review standards, and deprecation plans are explicit. Otherwise, temporary exceptions tend to become permanent shadow patterns.

Practitioner takeaway: treat approved modules as the place where policy is enforced and exceptions are made visible; treat direct resource creation as a deliberate deviation that needs stronger review, not as a harmless shortcut.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

CIS Controls v8 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
CIS Controls v8CIS 4 — Secure Configuration of Enterprise Assets and SoftwareApproved modules standardise secure configuration across repeated infrastructure patterns.
Recommendation — Use CIS 4 to standardise provisioning baselines and reduce configuration drift.
NIST CSF 2.0PR.IP-1 — A baseline configuration of information technology/industrial control systems is created and maintainedModules preserve a maintained baseline while raw resources increase variance.
PR.AC-1 — Identities and credentials are issued, managed, verified, revoked, and audited for authorized devices, users and processesProvisioning choices often govern how identities and access are applied to new resources.
GV.PO-1 — Organizational cybersecurity policy is established and communicatedApproved modules operationalise policy into repeatable infrastructure patterns.
Recommendation — Maintain baseline configurations through approved modules and control any exceptions. Apply controlled provisioning paths so access and ownership are consistently assigned. Translate policy into approved modules so teams provision to one governed standard.

Practitioner Guidance

What to prioritise: assess whether the module actually encodes enforceable guardrails, not just shared templates. A well-governed module should reduce review effort because the risky decisions have already been standardised.

Decision rule: if a resource type is common enough that three teams are likely to reimplement it differently, it belongs in a module. If the resource is genuinely unique or transitional, allow direct code only with an explicit exception path and a clear owner.

What to verify: confirm that the module version is pinned, the input surface is constrained, and the module’s defaults match the organisation’s baseline for security, logging, and ownership. If reviewers must inspect the internals every time, the module is not yet doing its job.

Common mistake: teams often assume module use automatically means governance is solved. The real control strength comes from what the module enforces, how exceptions are approved, and whether the module is kept current as standards change.

Practitioner takeaway: the best architecture is not “modules versus code” in the abstract; it is a provisioning model where approved modules carry the standard path and direct resource creation is reserved for cases that can justify the extra variance.

Deepen Your Knowledge

Sign up to our weekly newsletter — get 33% off our NHI Foundation Level Course

    NHIMG Editorial Note
    Reviewed and updated by the NHIMG editorial team on September 8, 2026.
    NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org