Feature Request - Data Source for handling Gitlab security-policies as code
New Data Source
Taken from @mpapadopoullos original submission:
- Currently, if you want to have the security policies defined in TF, the only way is to include the content of the YAML file as a multiline string.
- It would be nice to have a resource designed to generate the final YAML content written with TF constructs.
New Data Source that can be used to create and manage policies:
- Pipeline Execution Policy
- Scan Execution Policy
- Vulnerability Management Policy
- Merge Request Approval Policy
End Result will be used like:
data "gitlab_security_policy_document" "scan" {
scan_execution_policy {
rules { ... }
actions { ... }
}
}
resource "gitlab_repository_file" "policy" {
content = data.gitlab_security_policy_document.scan.yaml
}
Related GitLab APIs
API documentation:
- Mutation.securityPolicyProjectCreateAsync
- Mutation.resyncSecurityPolicies
- Project.securityPolicies
- Group.securityPolicies
Existing Terraform Provider docs:
Additional Details
-
GitLab REST API resources available (read for data sources, CRUD for resources) -
client-go supports the related GitLab API already -
I'd like to contribute it myself
Edited by Carlos Corona