Skip to content

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 is a read-only operation that generates a plan file of the changes that Terraform will make to your infrastructure. When a pull request is opened or updated with changes to Terraform code, Terrateam automatically triggers a Plan operation.

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

  2. Terrateam automatically runs a Plan operation and comments on the pull request with the plan file output.

  3. Review the plan file output and collaborate with your team to ensure the changes are as expected.

You can also manually trigger a Plan operation by commenting terrateam plan on the pull request.

Apply

The Apply operation executes the plan generated by the Plan operation. It makes the actual changes to your infrastructure.

To trigger an Apply operation:

  1. Ensure that the pull request has a successful Plan operation.

  2. Comment terrateam apply on the pull request.

  3. Terrateam acquires a lock, runs the Apply operation, and comments on the pull request with the terraform apply output.

  4. Merge the pull request to complete the changes.

  5. Terrateam 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

Terrateam can be configured to automatically apply changes when a pull request is merged. This is called Auto-Apply and can be enabled using When Modified.

Apply: Pre-merge Vs. Post-merge

Terrateam offers different workflows, primarily focusing on when to apply changes: before merge (pre-merge) or after merge (post-merge).

Choosing between pre-merge and post-merge workflows with Terrateam depends on your specific requirements and constraints. Pre-merge workflows provide greater safety and visibility at the cost of complexity and speed, whereas post-merge workflows offer simplicity and speed but with increased risk.

For environments where stability is paramount, implementing a pre-merge workflow with automerge enabled can offer a balanced approach, ensuring both thorough validation and efficient merging.