Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dasmeta/terraform-gitlab-project
Terraform modules from DasMeta to manage GitLab resources
https://github.com/dasmeta/terraform-gitlab-project
gitlab gitlab-ci gitlab-runner
Last synced: about 1 month ago
JSON representation
Terraform modules from DasMeta to manage GitLab resources
- Host: GitHub
- URL: https://github.com/dasmeta/terraform-gitlab-project
- Owner: dasmeta
- License: apache-2.0
- Created: 2022-09-22T07:23:40.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-13T13:40:27.000Z (10 months ago)
- Last Synced: 2024-04-02T05:54:46.270Z (9 months ago)
- Topics: gitlab, gitlab-ci, gitlab-runner
- Language: HCL
- Homepage: https://www.dasmeta.com
- Size: 30.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Introduction
This Repository allows to manage the lifecycle of a gitlab project. Create protected branch, add piplines, variables etc.
# gitlab_project
## Configuration of provider
```bashterraform {
required_providers {
gitlab = {
source = "gitlabhq/gitlab"
version = ">3.0.0"
}
}
}provider "gitlab" {
token = "" // your gitlab Personal access token
}```
## Minimal example of module```terraform
module "gitlab_project" {
source = "dasmeta/project/gitlab/"
version = "1.1.1"name = "test-project"
description = "Some test project"
initialize_with_readme = true
visibility_level = "public"
approvals_before_merge = 1
default_branch = main
merge_method = "ff"
url = "https://xxxxxxx.xxx"
pipline_schedule_value = "test"
pipline_schedule_key = "test"
}
```## Some other example of usage to create variable
```terraform
module "gitlab_project" {
source = "dasmeta/project/gitlab/"
version = "1.1.1"name = "test-project"
description = "Some test project"
visibility_level = "private"
create_variable = true
only_allow_merge_if_all_discussions_are_resolved = true
only_allow_merge_if_pipeline_succeeds = true
remove_source_branch_after_merge = true
project_variable_key = "project_variable_key"
project_variable_value = "project_variable_value"
masked = true
protected = true
url = "https://xxxxxxx.xxx"
pipline_schedule_value = "test"
pipline_schedule_key = "test"}
```## Some other example of usage with createing webhook, pipline, branch
```terraform
module "gitlab_project" {
source = "dasmeta/project/gitlab/"
version = "1.1.1"name = "test-project"
description = "Some test project"
visibility_level = "private"
create_webhook = true
confidential_issues_events = true
enable_ssl_verification = true
create_pipline = true
create_branch = true
job_events = true
pipeline_events = true
push_events = true
token = true
ref = "main"
cron = "0 1 * * *"
url = "https://xxxxxxx.xxx"
pipline_schedule_value = "test"
pipline_schedule_key = "test"
branch_name = "das-meta"}
```## Requirements for pre-commit hooks
for Run our pre-commit hooks you need to install
- terraform
- terraform-docs## Require for prevent wrong commit msg
```bash
npm install --global git-conventional-commits
```## Config for GitHooks
```bash
git config core.hooksPath githooks
```## Requirements
| Name | Version |
|------|---------|
| [gitlab](#requirement\_gitlab) | >3.0.0 |## Providers
| Name | Version |
|------|---------|
| [gitlab](#provider\_gitlab) | >3.0.0 |## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [gitlab_branch.branch](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/branch) | resource |
| [gitlab_branch_protection.branch_protection](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/branch_protection) | resource |
| [gitlab_pipeline_schedule.pipline_schedule](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/pipeline_schedule) | resource |
| [gitlab_pipeline_schedule_variable.pipline_schedule_variable](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/pipeline_schedule_variable) | resource |
| [gitlab_pipeline_trigger.pipline_trigger](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/pipeline_trigger) | resource |
| [gitlab_project.this](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/project) | resource |
| [gitlab_project_hook.project_webhook](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/project_hook) | resource |
| [gitlab_project_variable.project_variable](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/project_variable) | resource |## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [active](#input\_active) | (Boolean) The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially. | `bool` | `false` | no |
| [approvals\_before\_merge](#input\_approvals\_before\_merge) | (Optional) Number of merge request approvals required for merging. Default is 0. | `string` | `1` | no |
| [branch\_name](#input\_branch\_name) | (String) The name for this branch. | `string` | `"develop"` | no |
| [confidential\_issues\_events](#input\_confidential\_issues\_events) | (Boolean) Invoke the hook for confidential issues events. | `bool` | `false` | no |
| [confidential\_note\_events](#input\_confidential\_note\_events) | (Boolean) Invoke the hook for confidential notes events. | `bool` | `false` | no |
| [create](#input\_create) | Boolean to create the resource. Defaults to true. | `bool` | `true` | no |
| [create\_branch](#input\_create\_branch) | Boolean to create the branch. Defaults to true. | `bool` | `true` | no |
| [create\_pipline](#input\_create\_pipline) | Boolean to create the pipline. Defaults to true. | `bool` | `true` | no |
| [create\_variable](#input\_create\_variable) | Boolean to create the resource variable. Defaults to true. | `bool` | `true` | no |
| [create\_webhook](#input\_create\_webhook) | Boolean to create the webhook. Defaults to true. | `bool` | `true` | no |
| [cron](#input\_cron) | (String) The cron (e.g. 0 1 * * *). | `string` | `"0 1 * * *"` | no |
| [default\_branch](#input\_default\_branch) | (Optional) The default branch the repository will use. Defaults to main. | `string` | `"main"` | no |
| [deployment\_events](#input\_deployment\_events) | (Boolean) Invoke the hook for deployment events. | `bool` | `false` | no |
| [description](#input\_description) | (Optional) A description of the project. | `string` | `"Repository for testing"` | no |
| [enable\_ssl\_verification](#input\_enable\_ssl\_verification) | (Boolean) Enable ssl verification when invoking the hook. | `bool` | `false` | no |
| [initialize\_with\_readme](#input\_initialize\_with\_readme) | (Optional) Create main branch with first commit containing a README.md file. | `bool` | `false` | no |
| [issues\_events](#input\_issues\_events) | (Boolean) Invoke the hook for issues events. | `bool` | `false` | no |
| [job\_events](#input\_job\_events) | (Boolean) Invoke the hook for job events. | `bool` | `false` | no |
| [lfs\_enabled](#input\_lfs\_enabled) | (Optional) Enable LFS for the project. | `bool` | `false` | no |
| [masked](#input\_masked) | (Boolean) If set to true, the value of the variable will be hidden in job logs. The value must meet the masking requirements. Defaults to false. | `bool` | `false` | no |
| [merge\_access\_level](#input\_merge\_access\_level) | (String) Access levels allowed to merge. Valid values are: no one, developer, maintainer. | `string` | `"maintainer"` | no |
| [merge\_commit\_template](#input\_merge\_commit\_template) | Template used to create merge commit message in merge requests. | `string` | `null` | no |
| [merge\_method](#input\_merge\_method) | (Optional) Set to `ff` to create fast-forward merges. Valid values are `merge`, `rebase_merge`, `ff`. | `string` | `"ff"` | no |
| [merge\_requests\_events](#input\_merge\_requests\_events) | (Boolean) Invoke the hook for merge requests. | `bool` | `false` | no |
| [name](#input\_name) | The name of the project to be created | `string` | n/a | yes |
| [only\_allow\_merge\_if\_all\_discussions\_are\_resolved](#input\_only\_allow\_merge\_if\_all\_discussions\_are\_resolved) | (Optional) Set to true if you want to allow merges only if all discussions are resolved. | `bool` | `true` | no |
| [only\_allow\_merge\_if\_pipeline\_succeeds](#input\_only\_allow\_merge\_if\_pipeline\_succeeds) | (Optional) Set to true if you want to allow merges only if a pipeline succeeds. | `bool` | `true` | no |
| [packages\_enabled](#input\_packages\_enabled) | (Optional) Enable packages repository for the project. | `bool` | `false` | no |
| [pages\_access\_level](#input\_pages\_access\_level) | (Optional) Enable pages access control. Valid values are `disabled`, `private`, `enabled`, `public`. | `string` | `"private"` | no |
| [pipeline\_events](#input\_pipeline\_events) | (Boolean) Invoke the hook for pipeline events. | `bool` | `false` | no |
| [pipline\_schedule\_key](#input\_pipline\_schedule\_key) | (String) Name of the variable. | `string` | n/a | yes |
| [pipline\_schedule\_value](#input\_pipline\_schedule\_value) | (String) Value of the variable. | `string` | n/a | yes |
| [pipline\_trigger\_description](#input\_pipline\_trigger\_description) | (String) The description of the pipeline trigger. | `string` | `""` | no |
| [project\_variable\_key](#input\_project\_variable\_key) | (String) The name of the variable. | `string` | n/a | yes |
| [project\_variable\_value](#input\_project\_variable\_value) | (String, Sensitive) The value of the variable. | `string` | n/a | yes |
| [protected](#input\_protected) | (Boolean) If set to true, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false. | `bool` | `false` | no |
| [push\_access\_level](#input\_push\_access\_level) | (String) Access levels allowed to push. Valid values are: no one, developer, maintainer. | `string` | `"maintainer"` | no |
| [push\_events](#input\_push\_events) | (Boolean) Invoke the hook for push events. | `bool` | `false` | no |
| [push\_events\_branch\_filter](#input\_push\_events\_branch\_filter) | (String) Invoke the hook for push events on matching branches only. | `bool` | `false` | no |
| [push\_rules](#input\_push\_rules) | An array containing the push rules object. | `list(object({}))` |[| no |
{
"commit_committer_check": true,
"prevent_secrets": true
}
]
| [ref](#input\_ref) | (String) The branch/tag name to be triggered. | `string` | `"main"` | no |
| [releases\_events](#input\_releases\_events) | (Boolean) Invoke the hook for releases events. | `bool` | `false` | no |
| [remove\_source\_branch\_after\_merge](#input\_remove\_source\_branch\_after\_merge) | (Optional) Enable `Delete source branch` option by default for all new merge requests. | `bool` | `true` | no |
| [request\_access\_enabled](#input\_request\_access\_enabled) | (Optional) Allow users to request member access. | `bool` | `true` | no |
| [snippets\_enabled](#input\_snippets\_enabled) | (Optional) Enable snippets for the project. | `bool` | `false` | no |
| [suggestion\_commit\_message](#input\_suggestion\_commit\_message) | The commit message used to apply merge request suggestions. | `string` | `null` | no |
| [tag\_push\_events](#input\_tag\_push\_events) | (Boolean) Invoke the hook for tag push events. | `bool` | `false` | no |
| [token](#input\_token) | (String, Sensitive) A token to present when invoking the hook. The token is not available for imported resources. | `bool` | `false` | no |
| [url](#input\_url) | (String) The url of the hook to invoke. | `string` | n/a | yes |
| [visibility\_level](#input\_visibility\_level) | (Optional) Set to `public` to create a public project. Valid values are `private`, `internal`, `public`. | `string` | `"private"` | no |
| [wiki\_enabled](#input\_wiki\_enabled) | (Optional) Enable wiki for the project. | `bool` | `false` | no |## Outputs
| Name | Description |
|------|-------------|
| [gitlab\_project\_id](#output\_gitlab\_project\_id) | n/a |