New Data Source gitlab_project_approval_rule
New Data Source
I think that a data source to be able to easily importgitlab_project_approval_rule
could be needed.
I've experienced the following. I'd really appreciate any suggestion in the case that there is a possible workaround.
When creating a project with useCustomTemplate
and the referenced template contains project approval rules those are added to the created project. (Both any_approver
and regular
types)
Given a new resource (cdktf) that points to a template project that contains two approval rules (any_approver
and a regular
one called myCustomRule
)
const myTemplateProjectId = 3333 // Lets assume a direct id here for this example
const project = new Project(this, 'MyNewProject', {
name,
description: 'My new project description',
namespaceId: 1234, // Some namespace
visibilityLevel: 'private',
useCustomTemplate: true,
groupWithProjectTemplatesId: 2223, // Some group id
templateProjectId: myTemplateProjectId // Some project id
})
When MyNewProject
is created Gitlab will also create two approval rules with same values as approval rules from template. There seems to be no easy way to import those to tweak their values.
This new data source should be able to select,at least, by project
and name
and/or rule_type
A real life scenario is, for instance, that you may have a template Gitlab project with different merge request approver than the projects created out of that template.
Alternatively, an option to not import approval rules from imported template could be a very good solution for this case. In that way there would be no approval rules to try to import and modify.
-->
Related GitLab APIs
API documentation: https://docs.gitlab.com/ee/api/merge_request_approvals.html