Join our Newsletter — 33% off our NHI Course
Home FAQ Governance, Ownership & Risk How do organisations decide whether to import existing…
Governance, Ownership & Risk

How do organisations decide whether to import existing cache resources or recreate them under Terraform?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated August 28, 2026 Domain: Governance, Ownership & Risk

Organisations should choose import when the resource is already in production and must be brought under control without disruption. Recreate only when the existing object is unsuitable or cannot be governed reliably. The decision should weigh service criticality, operational risk, and the need for an auditable, repeatable management model.

Why This Matters for Security Teams

terraform import versus recreate is not just a tooling choice. It determines whether an existing cache becomes part of a controlled infrastructure lifecycle or remains an unmanaged exception that can drift, leak data, or resist audit. For security teams, the decision affects change control, rollback confidence, and whether the cache can be governed under the same standards as the rest of the estate. NIST’s NIST SP 800-53 Rev 5 Security and Privacy Controls is clear that configuration and access controls only work when assets are consistently identifiable and managed.

This matters even more when caches hold sessions, tokens, or application state. A recreate path may be safer if the cache is disposable, but import is usually the better option when the resource is production-critical and already embedded in service dependencies. NHIMG research on Code Formatting Tools Credential Leaks shows how easily weakly governed infrastructure can expose sensitive material when ownership and lifecycle are unclear. In practice, many teams discover the need to import only after a live cache has already been treated as “temporary” for far too long.

How It Works in Practice

The decision starts with an inventory question: does the cache already exist, and does Terraform need to take over without changing service behaviour? If yes, import is the usual path. Import brings the object into state so future changes are managed declaratively, but it does not fix a poorly designed resource by itself. Teams still need to review the actual configuration, compare it with desired state, and confirm that the cache can be versioned, reviewed, and reconstructed predictably.

Recreate is appropriate when the existing cache is misaligned with governance requirements, hard to model cleanly, or too risky to retain. That often applies when the resource has undocumented manual changes, fragile dependencies, or settings that cannot be reproduced safely in code. For security and reliability teams, the practical test is whether the cache can be destroyed and rebuilt without breaking dependent applications or losing data that matters. If it cannot, import is often the only realistic option.

  • Use import when the cache is production live, dependency-rich, and must avoid downtime.
  • Use recreate when the object is non-compliant, ephemeral, or impossible to manage consistently.
  • Validate whether the cache contains durable data, secrets, or session material before choosing recreate.
  • Document ownership, rollback, and state reconciliation before modifying Terraform state.

NHIMG guidance on the Ultimate Guide to NHI Management reinforces a core operational principle: unmanaged assets become risk multipliers once they are tied to identities, secrets, or access paths. A second signal appears in JetBrains GitHub plugin token exposure, where exposure was amplified by weak control over sensitive runtime material. These controls tend to break down when a cache is shared across environments and the actual runtime configuration no longer matches what Terraform can safely declare.

Common Variations and Edge Cases

Tighter Terraform control often increases operational overhead, requiring organisations to balance governance against application fragility. That tradeoff is most visible with caches that are partially stateful, multi-tenant, or tightly coupled to incident recovery. Current guidance suggests treating disposable caches differently from caches that influence authentication, authorization, or business-critical persistence, but there is no universal standard for this yet.

A few edge cases usually determine the final choice. Imported resources can still be recreated later if their configuration proves too messy to maintain. Recreated resources may need migration planning if applications assume a stable endpoint or keyspace. For environments with strict change windows, import is often safer because it minimizes disruption, while rebuilds are better suited to non-production or recovery-focused systems. Security teams should also confirm whether cache encryption, access policies, and secrets handling can be expressed reliably in Terraform before committing to a recreate strategy.

Where this guidance becomes less useful is when the cache is embedded in a broader platform dependency chain, such as application sessions, distributed locking, or ephemeral job coordination. In those environments, the technical question is not simply import or recreate, but whether the platform can tolerate a controlled transition without service degradation. NHIMG’s research on Gladinet Hard-Coded Keys RCE Exploitation and ASP.NET machine keys RCE attack both underscore how hidden dependencies and brittle configuration turn routine maintenance into a security event.

Standards & Framework Alignment

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

OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST CSF 2.0, NIST SP 800-53 Rev 5, NIST AI RMF and NIST Zero Trust (SP 800-207) set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST CSF 2.0CM-2Cache import or recreate decisions depend on baseline configuration control.
NIST SP 800-53 Rev 5CM-6Covers enforcing secure, standard settings after Terraform takes control.
OWASP Non-Human Identity Top 10NHI-01Caches often store secrets or access material tied to non-human identities.
NIST AI RMFRisk-based governance applies when deciding whether to preserve or replace live infrastructure.
NIST Zero Trust (SP 800-207)SC.L2-3Zero trust requires each managed resource to be explicitly controlled and monitored.

Define the cache baseline first, then import or rebuild only to achieve that approved configuration.

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