Question: migration from approvals_before_merge option to gitlab_project_approval_rule resource

Hi there,

We currently use gitlabhq/gitlab provider version 18.1.1 to manage a large number of repositories, groups, and other resources. We are planning to upgrade the Terraform provider to version 18.5.0, and during this process we discovered that many of our resources will be deprecated in version 19.0.

We have started addressing the deprecation warnings, and one of the most critical changes for us is the migration from the approvals_before_merge option to the gitlab_project_approval_rule resource.

When running terraform apply for existing projects, we encountered the following error:

POST https://gitlab.com/api/v4/projects/${ID}/approval_rules: 400 { message: { rule_type: [any-approver for the project already exists] } }

It appears that these approval rules already exist in GitLab, but Terraform is unaware of them. As a result, we would need to import this resource for all projects.

Do you have any advice on how to smoothly migrate to gitlab_project_approval_rule without having to manually import a large number of existing resources?

Edited Jan 22, 2026 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading