linear_git_automation_state
Manages one git automation rule of a Linear team: when the given git event fires, linked issues move to the given workflow state. Each Linear GitAutomationState covers exactly one event, so five events means five resources. Combined with linear_git_automation_target_branch this also expresses per-branch overrides — a rule with target_branch_id set applies only to pull requests targeting that branch pattern and overrides the team's default rule for the same event.
linear_git_automation_state (Resource)
Manages one git automation rule of a Linear team: when the given git event fires, linked issues move to the given workflow state.
Each Linear GitAutomationState covers exactly one event, so five events means five resources. Combined with linear_git_automation_target_branch this also expresses per-branch overrides — a rule with target_branch_id set applies only to pull requests targeting that branch pattern and overrides the team's default rule for the same event.
Example Usage
# One resource per git event. Bundling all five into one resource is what stops
# `merge` round-tripping elsewhere.
resource "linear_git_automation_state" "start" {
team_id = linear_team.engineering.id
event = "start"
state_id = linear_workflow_state.in_progress.id
}
resource "linear_git_automation_state" "review" {
team_id = linear_team.engineering.id
event = "review"
state_id = linear_workflow_state.in_review.id
}
resource "linear_git_automation_state" "merge" {
team_id = linear_team.engineering.id
event = "merge"
state_id = linear_workflow_state.done.id
}
# A rule scoped to a branch pattern overrides the team default for that event.
resource "linear_git_automation_state" "merge_to_main" {
team_id = linear_team.engineering.id
event = "merge"
state_id = linear_workflow_state.released.id
target_branch_id = linear_git_automation_target_branch.main.id
}
Schema
Required
event(String) Git event that triggers the rule — one ofdraft(draft PR opened),start(branch created),review(PR ready for review),mergeable(PR approved and mergeable) ormerge(PR merged).team_id(String) UUID of the team the rule belongs to. Changing it replaces the rule —gitAutomationStateUpdatehas noteamId.
Optional
state_id(String) UUID of the workflow state linked issues move to. Leave unset to make the rule take no action — which is how a team overrides an inherited default for this event.target_branch_id(String) UUID of alinear_git_automation_target_branchthis rule is scoped to. Unset means the rule applies to pull requests against any branch.
Read-Only
id(String) UUID of the automation rule.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
# Import by UUID.
terraform import linear_git_automation_state.example a1b2c3d4-0000-0000-0000-000000000000