Skip to content

inconsistent result after apply with gitlab_project_level_mr_approvals

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Bug Report

We are utilizing the resource gitlab_project_level_mr_approvals inside of a module for managing project configurations.

After executing a terraform apply we get the below results for each instance of this rule resulting in inconsistent application.

This is caused by the Admin area setting of Push Rules > Merge request approvals > Prevent approval by author AND/OR Push Rules > Merge request approvals > Prevent approvals by user who add commits rules.

Once those two rules have been unchecked the resource applies successfully without an inconsistent state. I think it would be good if this resource checked if that value is set during a plan when merge_requests_author_approval is set to true or merge_requests_disable_committers_approval is set to false and throws an error on plan so its easier for users to understand why their resource approval failed.

Relevant Terraform Configuration

resource "gitlab_project_level_mr_approvals" "project" {
  project                                        = gitlab_project.project.id
  reset_approvals_on_push                        = true
  disable_overriding_approvers_per_merge_request = false
  merge_requests_author_approval                 = true
  merge_requests_disable_committers_approval     = false
}

Relevant Terraform Command

terraform apply

Relevant Log Output


│ Error: Provider produced inconsistent result after apply

│ When applying changes to module.asdf123.gitlab_project_level_mr_approvals.project, provider "provider[\"registry.terraform.io/gitlabhq/gitlab\"]" produced an unexpected new value:
│ .merge_requests_author_approval: was cty.True, but now cty.False.

│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

Additional Details

  • GitLab Terraform Provider Version: 18.0.0
  • GitLab Instance Version: 18.0.2
  • Terraform Version: 1.5.7
Edited by 🤖 GitLab Bot 🤖