# Terraform: "Missing or incomplete configuration" after moving files around

## What you are seeing

```
Error: Missing or incomplete configuration

...
```

Variants: Terraform initialized a backend but the config no longer declares it, a module source moved, or provider requirements vanished. This shows up after refactors, branch switches, and partial merges.

## First response

1. `git status` and `git diff --stat`. Nine times in ten a file was renamed, deleted, or never committed. The missing piece is usually visible in the diff.
2. Check that every `terraform {}` block, backend block, and required_providers block the init expects still exists in the current files.
3. Branch switches with different backend configs need `init -reconfigure`. The error after a branch switch is the backend binding from the other branch.

## Rules for agents

1. Do not delete `.terraform/` and re-init as the first move. Re-init against the wrong or incomplete config can rebind the backend or reinstall different providers. Read the file layout first.
2. Partial merges (backend block merged, backend config file not) are a classic. Verify both sides of any backend change made it into the branch.
3. If the config was intentionally restructured, say which init flag the restructure needs (`-reconfigure`, `-migrate-state`) instead of letting init guess.
4. Keep `terraform validate` in the loop after any file move. It catches missing references in seconds with no cloud access.
