Unable to Create Project: error while waiting for branch main to reach 'protected' status

Created by: tschechniker

GitLab Provider version

3.15.1

GitLab version

14.10.3

Terraform version

1.1.3

Relevant Terraform Configuration

resource "gitlab_project" "test_project" {
    name = "test"
    description = "test"
    default_branch = "main"
    initialize_with_readme = true
}

Relevant log output

Error: error while waiting for branch main to reach 'protected' status, timeout while waiting for state to become 'true'

Description

Currently i'm unable to create a new Project if it's not in a group where branch protection is turned off in the group settings. It seems like the default behaviour of gitlab has changed and in the project creation there is no default branch protection any more. This also applies if i create the project manually. There is not branch protection created for the default branch.

https://github.com/gitlabhq/terraform-provider-gitlab/blob/main/internal/provider/resource_gitlab_project.go#L1083 here you rely on that there will always be a branch protection. And course of the fact that gitlab will not create one the timeout of 2 minutes hit always.

Till now i was unable to find any working workaround for this issue. Am i the only one?