Menu

Managing Existing Infrastructure

Managing Existing Infrastructure

Importing Existing Infrastructure into Terraform

  • Import brings an existing remote object under Terraform management. First write a resource block that accurately describes the object, then use an import block or the supported CLI import workflow.
  • Import establishes the state association; it does not automatically generate a complete, correct configuration for every argument. Inspect the object and plan until configuration and remote reality agree.

Refactoring Terraform Configurations and Managing Resource Changes

  • Refactoring may involve renaming resources, extracting modules or reorganising files. A simple file move usually does not change resource identity, but changing an address can.
  • Use `moved` blocks to tell Terraform that an object has a new address, and review the plan to confirm it is not destroyed and recreated. Apply refactors in small, reviewable steps.

Identifying Infrastructure Drift and State Reconciliation

  • Drift occurs when real infrastructure changes outside Terraform or differs from the last recorded state. A plan refreshes information from providers and reports proposed reconciliation.
  • Do not blindly apply a plan that removes an emergency fix.
  • Investigate whether the manual change was intentional. Update configuration if the new setting should remain, or apply the desired configuration if it should be reverted.

Terraform Tutorial

HA

Harini A



Learn via Video Course

undefined Logo

NaN hrs



Get in Touch For Details