Skip to content
If you like Terrateam, give us a star 🌟 on GitHub.

Plan and Apply

The Plan and Apply operations are the core of Terrateam’s functionality. They allow you to preview and execute changes to your infrastructure in a controlled and collaborative manner.

Plan

The Plan operation generates a preview of changes that will be made to your infrastructure when you apply your Terraform code. This preview is called a “plan” in Terraform terminology.

The following example shows a common usage of the plan feature, enabling you to review changes and collaborate with your team before the changes are applied:

  1. Open a pull request with changes to your Terraform code.

    Terrateam pull request

  2. Terrateam automatically triggers a Plan operation.

  3. Review the plan output in the PR comment. It shows what will be created, modified, or destroyed:

    Terrateam plan

You can manually trigger another Plan by commenting terrateam plan on the pull request.

Apply

The Apply operation executes the changes previewed in the Plan. This is when actual infrastructure changes occur. Here’s an example of a common usage of the apply feature:

  1. Ensure your pull request has a successful Plan operation.

  2. Comment terrateam apply on the pull request.

  3. Terrateam acquires a lock on the affected directories to prevent conflicting changes.

  4. Terrateam runs the Apply operation:

    Terrateam Apply

  5. Verify the apply was successful by reviewing the output.

  6. Merge the pull request to complete your workflow.

  7. Terrateam automatically releases the lock.

Apply Requirements

Terrateam has a set of Apply Requirements that must be met before an Apply operation can be triggered. These include:

You can configure these requirements in your Terrateam configuration file.

Auto-Apply

If you want to automatically apply changes when a pull request is merged, you can use the When Modified feature.

when_modified:
autoapply: true

Apply Before Merge vs. After Merge

Terrateam supports two main approaches based on when infrastructure changes are applied, either before or after a pull request is merged. This flexibility lets you match your deployment process to your team’s needs.

Terrateam lets you define the sequence of steps during Plan and Apply. You can customize these steps to enforce approvals, manage concurrency, or trigger applies at the right time.

If you want to validate and apply changes before merging, you can use a pre-merge approach combined with automerge to apply changes automatically once checks pass.