Repaso
EspaƱol
Cloud & DevOpsIntermediateOPS-16

What does terraform plan do?

Options

  1. It applies the changes immediately to the real infrastructure
  2. It compares config and state and shows what would change (Correct option)
  3. It deletes the state file so that the next run starts from clean
  4. It formats the code files so that they match the Terraform style

Answer

Compares desired config with state and real infrastructure, and shows what would change without changing anything

Why

Terraform describes infrastructure (servers, databases, networks) as code. That is Infrastructure as Code.

terraform plan is a dry run: it compares your code with what exists and lists what it WOULD create, change or destroy. Nothing changes yet.

After reviewing, terraform apply makes the changes. The state file maps code to real resources; keep it in shared remote storage with locking.

Remember

plan = preview. apply = do it.

Key terms

Practice this question in Repaso