Skip to content

Apply requirements

Apply requirements in Terrateam allow you to define a set of conditions that must be met before an apply operation can be executed on a pull request. These requirements help ensure that changes to your infrastructure are properly reviewed and approved before being applied.

Configuration

Apply Requirements are configured in the .terrateam/config.yml file under the apply_requirements.checks key. Here’s the default configuration:

apply_requirements:
checks:
approved:
enabled: false
count: 1
merge_conflicts:
enabled: true
status_checks:
enabled: true
ignore_matching: []

Approved

The approved key is used to specify whether a certain number of approvals are required on the pull request before an apply operation can be executed.

KeyTypeDescription
enabledBooleanSpecifies whether the approval requirement is enabled. Default is false.
countIntegerThe number of approvals required. Default is 1.

Merge conflicts

The merge_conflicts key is used to specify whether the pull request must have no merge conflicts before an apply operation can be executed.

KeyTypeDescription
enabledBooleanSpecifies whether the merge conflict check is enabled. Default is true.

Status checks

The status_checks key is used to specify whether all status checks associated with the pull request must pass before an apply operation can be executed.

KeyTypeDescription
enabledBooleanSpecifies whether the status checks requirement is enabled. Default is true.
ignore_matchingListA list of regular expressions. Status checks matching any of these expressions will be ignored. Default is [].

Examples

Require 2 approvals and no merge conflicts

apply_requirements:
checks:
approved:
enabled: true
count: 2
merge_conflicts:
enabled: true

This configuration will require the pull request to have at least 2 approvals and no merge conflicts before an apply operation can be executed.

Require status checks, ignoring certain checks

apply_requirements:
checks:
status_checks:
enabled: true
ignore_matching:
- "ci/.*"
- "lint"

This configuration will require all status checks associated with the pull request to pass before an apply operation can be executed, except for checks matching the regular expressions "ci/.*" or "lint".

Considerations

When configuring apply requirements, keep the following in mind:

  • Apply requirements are evaluated whenever an apply operation is attempted, whether manually or through an autoapply trigger.
  • If any of the enabled requirements are not met, the apply operation will not be executed, and an error message will be displayed.
  • Apply requirements can be overridden using the terrateam apply-force command, which bypasses all requirements. This command should be used with caution and only by authorized users.
We use cookies and similar technologies to provide certain features, enhance the user experience and deliver content that is relevant to your interests. Depending on their purpose, analysis and marketing cookies may be used in addition to technically necessary cookies. By clicking on "Agree and continue", you declare your consent to the use of the aforementioned cookies. Here you can make detailed settings or revoke your consent (in part if necessary) with effect for the future. For further information, please refer to our Privacy Policy .