Terraform can run `terraform apply` without a separate `terraform plan` command first. A plan offers a useful preview of proposed infrastructure changes, especially in production, but it isn’t a required step. Knowing the difference helps you choose when a quick apply is sensible and when a careful review matters.

Multiple Choice

Will terraform apply fail if terraform plan was not executed first?

When you use Terraform, the command `terraform apply` is designed to execute the changes specified in a configuration file based on the current state of your infrastructure. It does not require a `terraform plan` to be run first for the apply to be successful. The primary role of `terraform plan` is to generate an execution plan, which shows you what actions Terraform will take to reach the desired state defined in your configuration. However, it's not a prerequisite for running `terraform apply`. You can apply changes directly without reviewing the plan first by simply executing `terraform apply`. In practice, while it's recommended to run `terraform plan` before applying changes—especially in a production environment—to ensure that you understand the upcoming changes and can catch any unintended actions, Terraform is fully capable of applying configurations based on the current state even if the plan command has not been executed beforehand. Thus, the application of the changes will not inherently fail just because a plan was not previously generated, leading to the conclusion that the correct answer is that it will not fail simply due to the absence of a prior plan step.

Terraform doesn’t require a separate terraform plan command before terraform apply. You can run terraform apply directly, and Terraform will create a plan internally before it attempts to change your infrastructure. That distinction matters: a plan is still part of the process, even when you don’t ask to see it as a separate step.

Think of Terraform as a builder working from a set of instructions. The configuration describes the result you want, while the state file records what Terraform knows about the infrastructure it manages. Before making changes, Terraform compares those pieces of information with the real resources it can reach. A plan summarizes the changes it expects to make. When you run terraform apply without supplying a saved plan, Terraform generates that summary and then proceeds according to the command’s approval flow.

What happens when you run terraform apply?

In an interactive terminal, a typical terraform apply command shows a proposed set of actions and asks for confirmation. You might see that Terraform plans to add a virtual machine, update a network rule, or remove a resource that no longer appears in the configuration. If you confirm, Terraform carries out the work.

So there are two different ideas that can sound similar:

  • Running terraform plan as a separate command is optional.

  • Creating a plan before changes are made is part of Terraform’s normal apply process.

That’s why skipping the standalone plan command does not, by itself, cause terraform apply to fail. Terraform can calculate the proposed changes on its own. The plan command simply lets you inspect that proposal separately before committing to it.

This is a bit like asking a contractor to estimate a job before starting. You can ask for the estimate in a separate meeting, or you can have the contractor work out the steps when you authorize the job. The estimate still exists in some form; the difference is whether you reviewed it first.

Why use terraform plan separately?

A separate plan gives people time to understand what Terraform intends to do. That matters because infrastructure changes can have wider effects than a line of code suggests. A small edit to a security group, for instance, could alter who can reach an application. A change to a database setting might trigger a replacement rather than a simple update.

The plan output uses familiar markers to show the broad type of change. A plus sign generally indicates that Terraform will create a resource, a tilde signals an update, and a minus sign indicates removal. A replacement may show both removal and creation, often because the provider can’t change a particular property in place.

Reading the plan is not just a box to tick. It gives teams a chance to catch surprises: an unexpected deletion, a resource recreated under a new name, or a change that affects more components than intended. In production environments, that review can be a useful safety check. It’s also handy when several people share responsibility for infrastructure, since the person reviewing the plan may not be the person who wrote the configuration.

A saved plan changes the workflow

Terraform supports a more controlled, two-step workflow. First, a user can run terraform plan -out=tfplan to create a saved plan file. That file can then be passed to terraform apply tfplan.

In that case, Terraform applies the saved plan rather than creating a fresh one for approval. This is useful in automated systems. For example, a continuous integration pipeline can generate a plan, store it as an artifact, and make it available for review. Once approved, a later stage can apply that exact plan.

There’s an important detail here: a saved plan reflects the information available when it was created. If the configuration, state, or real infrastructure changes before the apply step, the saved plan may no longer be valid. Terraform can reject it rather than carry out changes based on outdated assumptions. That’s generally a safeguard, not a failure of the workflow.

Saved plan files can also contain sensitive information. They may include values from configuration or infrastructure data, so teams should handle them like other potentially confidential files. Avoid placing them in public repositories or leaving them where unauthorized users can access them.

When might terraform apply fail?

Although a prior standalone plan isn’t required, terraform apply can still fail for other reasons. Terraform may be unable to authenticate with a cloud provider, find a referenced module, or reach an API. A configuration could contain invalid syntax or refer to a resource argument that the provider doesn’t support. The requested infrastructure might also exceed an account quota, or a network issue could interrupt a change.

State can matter, too. If Terraform’s state is locked by another operation, a new apply may be blocked until the lock is released or the other work finishes. If the state is missing, corrupted, or out of date, Terraform may not have the information it needs to manage resources safely. Remote backends and state locking help teams coordinate, but they don’t eliminate every possible issue.

Approval behavior can affect what happens as well. In an interactive session, Terraform normally pauses and asks for confirmation before applying the changes. In an automated environment, a command might use -auto-approve to skip that prompt. This flag does not remove the need for a plan; it removes the human confirmation step. That can be useful in a carefully controlled pipeline, but it also means there’s less room to catch an unexpected change by eye.

Plan first, or apply directly?

For a small personal project, running terraform apply directly may be perfectly reasonable. Terraform displays the proposed actions and waits for confirmation, so you can still review the changes before they happen. In a team setting or a production environment, running terraform plan separately often provides a clearer review point and a useful record of intended changes.

Neither workflow is automatically safe or unsafe. The quality of the process depends on how changes are reviewed, how credentials are managed, and whether the team understands the resources under Terraform’s control. A plan can help reveal risk, but it can’t replace sound configuration or careful access controls. And a direct apply can still be well managed when the output is reviewed and the approval process is clear.

One habit worth keeping in mind is to treat the plan as a conversation with your infrastructure. Terraform is saying, “Here’s what I think needs to change.” If that summary doesn’t match what you expected, pause and investigate. Perhaps the configuration changed, the state doesn’t reflect reality, or a provider is proposing a replacement. Those are clues worth following before resources are altered.

The simple takeaway

Running terraform plan separately is not a prerequisite for terraform apply. When you run apply without a saved plan file, Terraform calculates a plan as part of the command and presents it for approval in an interactive workflow. The operation may fail for configuration, provider, state, permission, or infrastructure reasons—but not simply because you skipped the standalone plan command.

That makes the choice less about whether Terraform can apply changes and more about how much visibility your workflow needs. For quick, low-risk work, a direct apply may be enough. For shared or sensitive infrastructure, a separate plan gives people a better chance to review the proposed changes before they reach real systems.