{"id":20561141,"url":"https://github.com/willianpaixao/terraform-gitlab-project","last_synced_at":"2025-04-14T14:10:02.417Z","repository":{"id":48087806,"uuid":"390683245","full_name":"willianpaixao/terraform-gitlab-project","owner":"willianpaixao","description":"Terraform module for Gitlab projects","archived":false,"fork":false,"pushed_at":"2021-08-07T14:21:03.000Z","size":31,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T03:06:46.332Z","etag":null,"topics":["gitlab","terraform","terraform-module"],"latest_commit_sha":null,"homepage":"https://registry.terraform.io/modules/willianpaixao/project/gitlab/latest","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willianpaixao.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-29T10:15:08.000Z","updated_at":"2025-02-17T11:03:44.000Z","dependencies_parsed_at":"2022-08-12T18:20:33.535Z","dependency_job_id":null,"html_url":"https://github.com/willianpaixao/terraform-gitlab-project","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willianpaixao%2Fterraform-gitlab-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willianpaixao%2Fterraform-gitlab-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willianpaixao%2Fterraform-gitlab-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willianpaixao%2Fterraform-gitlab-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willianpaixao","download_url":"https://codeload.github.com/willianpaixao/terraform-gitlab-project/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248894939,"owners_count":21179152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gitlab","terraform","terraform-module"],"created_at":"2024-11-16T03:57:06.327Z","updated_at":"2025-04-14T14:10:02.382Z","avatar_url":"https://github.com/willianpaixao.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- BEGIN_TF_DOCS --\u003e\n![GitLab Logo](https://about.gitlab.com/images/press/logo/png/gitlab-logo-gray-rgb.png)\n\n# Gitlab project Terraform module\n\nThis module is built upon the [gitlabhq/gitlab](https://github.com/gitlabhq/terraform-provider-gitlab) provider, and is used to create a new Gitlab [projects](https://docs.gitlab.com/ee/user/project/) (aka Git repository) under an existing [group](https://docs.gitlab.com/ee/user/group/).\nIt reduces the boilerplate and has better security flags raised by default.\n\n-\u003e The group can be created or imported using [gitlab\\_group](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/group)\n\n## Default resources and features\n\n| Feature | Default |\n|---------|:-------:|\n| [CI/CD Pipelines](https://docs.gitlab.com/ee/ci/pipelines/) | `true` |\n| [Container Registry](https://docs.gitlab.com/ee/user/packages/container_registry/) | `true` |\n| [Git Large File Storage (LFS)](https://docs.gitlab.com/ee/topics/git/lfs/) | `false` |\n| [Gitlab Pages](https://docs.gitlab.com/ee/user/project/pages/) | `false` |\n| [Issues](https://docs.gitlab.com/ee/user/project/issues/) | `false` |\n| [Package Registry](https://docs.gitlab.com/ee/user/packages/package_registry/) | `false` |\n| [Snippets](https://docs.gitlab.com/ee/user/snippets.html) | `false` |\n| [Wiki](https://docs.gitlab.com/ee/user/project/wiki/) | `false` |\n\n## Examples\n\n### Create one repository\n\nPretty simple, add the following block and replace the values accordingly.\n\n```hcl\nmodule \"project\" {\n  source  = \"willianpaixao/project/gitlab\"\n  version = \"~\u003e 1.0.1\"\n\n  name         = \"My New Pet project\"\n  description  = \"Yet another project I will never finish\"\n  namespace_id = gitlab_group.some-group.id\n  tags         = [\"pet\", \"unfinished\"]\n}\n```\n\n### Create many repositories under the same [subgroup](https://docs.gitlab.com/ee/user/group/subgroups/)\n\nThe usage consists of two simple steps, first define your variable in `variables.tf` then add the `module` block to your code, referencing the `source` as following:\n\n```hcl\nvariable \"project\" {\n  description = \"list of attributes of a project\"\n  type        = map(any)\n  default = {\n    your-shiny-project = {\n      name        = \"your-shiny-project\"\n      description = \"A descriptive description\"\n      tags        = [\"tagA\", \"tagB\"]\n  }\n}\n\nmodule \"subgroup_projects\" {\n  source  = \"willianpaixao/project/gitlab\"\n  version = \"~\u003e 1.0.1\"\n\n  for_each = var.project\n\n  name         = each.value.name\n  description  = each.value.description\n  namespace_id = gitlab_group.some-group.id\n  tags         = setunion([\"subgroup\"], each.value.tags)\n}\n```\n\n### Setting a list of project owners\n\n```hcl\ndata \"gitlab_user\" \"owners\" {\n  for_each = toset([\"user1\", \"user2\", \"user3\"])\n  username = each.value\n}\n\nmodule \"api\" {\n  source  = \"willianpaixao/project/gitlab\"\n  version = \"~\u003e 1.0.1\"\n\n  name               = \"api\"\n  description        = \"REST API\"\n  namespace_id       = gitlab_group.some-group.id\n  approvals_required = 3\n  owners             = [for user in data.owners.users : user.id]\n  tags               = \"api\"\n}\n\nresource \"gitlab_project_membership\" \"owners\" {\n  for_each     = [for user in data.owners.users : user.id]\n\n  project_id   = module.api.id\n  user_id      = each.key\n  access_level = \"owners\"\n}\n```\n\nThat's it! Run `terraform plan` and check the output to see if matches your recent changes.\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"provider_gitlab\"\u003e\u003c/a\u003e [gitlab](#provider\\_gitlab) | \u003e= 3.7.0 |\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [gitlab_branch_protection.default](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/branch_protection) | resource |\n| [gitlab_pipeline_trigger.default](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/pipeline_trigger) | resource |\n| [gitlab_project.default](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/project) | resource |\n| [gitlab_project_approval_rule.default](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/project_approval_rule) | resource |\n| [gitlab_project_level_mr_approvals.default](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/project_level_mr_approvals) | resource |\n| [gitlab_tag_protection.default](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/tag_protection) | resource |\n\n## Inputs\n\n| Name | Description | Type | Default | Required |\n|------|-------------|------|---------|:--------:|\n| \u003ca name=\"input_description\"\u003e\u003c/a\u003e [description](#input\\_description) | A short description of the project | `string` | n/a | yes |\n| \u003ca name=\"input_name\"\u003e\u003c/a\u003e [name](#input\\_name) | Name of the project | `string` | n/a | yes |\n| \u003ca name=\"input_namespace_id\"\u003e\u003c/a\u003e [namespace\\_id](#input\\_namespace\\_id) | The group where the project belongs to | `string` | n/a | yes |\n| \u003ca name=\"input_approvals_required\"\u003e\u003c/a\u003e [approvals\\_required](#input\\_approvals\\_required) | The minimum number of approvals required for MRs | `number` | `1` | no |\n| \u003ca name=\"input_author_email_regex\"\u003e\u003c/a\u003e [author\\_email\\_regex](#input\\_author\\_email\\_regex) | All commit author emails must match this regex. As part of [Push Rules](https://docs.gitlab.com/ee/push_rules/push_rules.html), it's only available for GitLab Premium | `string` | `null` | no |\n| \u003ca name=\"input_container_registry_enabled\"\u003e\u003c/a\u003e [container\\_registry\\_enabled](#input\\_container\\_registry\\_enabled) | Enable container registry for the project | `bool` | `true` | no |\n| \u003ca name=\"input_default_branch\"\u003e\u003c/a\u003e [default\\_branch](#input\\_default\\_branch) | The default branch for the project | `string` | `\"main\"` | no |\n| \u003ca name=\"input_owners\"\u003e\u003c/a\u003e [owners](#input\\_owners) | A list of specific User IDs allowed to approve Merge Requests. Please refer to [Gitlab documentation](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/index.html) for further information | `list(string)` | `[]` | no |\n| \u003ca name=\"input_pipelines_enabled\"\u003e\u003c/a\u003e [pipelines\\_enabled](#input\\_pipelines\\_enabled) | Enable pipelines for the project | `bool` | `true` | no |\n| \u003ca name=\"input_shared_runners_enabled\"\u003e\u003c/a\u003e [shared\\_runners\\_enabled](#input\\_shared\\_runners\\_enabled) | Enable [shared runners](https://docs.gitlab.com/ee/ci/runners/) for the project | `bool` | `true` | no |\n| \u003ca name=\"input_tags\"\u003e\u003c/a\u003e [tags](#input\\_tags) | The list of tags to be attached to the project | `list(string)` | `[]` | no |\n| \u003ca name=\"input_template_project_id\"\u003e\u003c/a\u003e [template\\_project\\_id](#input\\_template\\_project\\_id) | Project ID of a custom project template. Please refer to [Gitlab documentation](https://docs.gitlab.com/ee/user/group/custom_project_templates.html) for further information | `number` | `null` | no |\n| \u003ca name=\"input_use_custom_template\"\u003e\u003c/a\u003e [use\\_custom\\_template](#input\\_use\\_custom\\_template) | Use either custom instance or group-level project template | `bool` | `false` | no |\n\n## Outputs\n\n| Name | Description |\n|------|-------------|\n| \u003ca name=\"output_id\"\u003e\u003c/a\u003e [id](#output\\_id) | Integer that uniquely identifies the project within the gitlab install |\n| \u003ca name=\"output_path_with_namespace\"\u003e\u003c/a\u003e [path\\_with\\_namespace](#output\\_path\\_with\\_namespace) | The path of the repository with namespace |\n| \u003ca name=\"output_web_url\"\u003e\u003c/a\u003e [web\\_url](#output\\_web\\_url) | URL that can be used to find the project in a browser |\n\n## Changelog\n\nPlease refer to our [changelog](/CHANGELOG.md) for further information on versioning and upgrades.\n\n## Contributing\n\nCheckout our [contributing](/CONTRIBUTING.md) guide.\n\n## References\n\n* [gitlab\\_project resource in GitLab Provider](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/project)\n\n* [Input Variables in Terraform](https://www.terraform.io/docs/language/values/variables.html)\n\u003c!-- END_TF_DOCS --\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillianpaixao%2Fterraform-gitlab-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillianpaixao%2Fterraform-gitlab-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillianpaixao%2Fterraform-gitlab-project/lists"}