update
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
.terraform*
|
||||||
|
.env
|
||||||
@@ -1,13 +1,44 @@
|
|||||||
terraform {
|
terraform {
|
||||||
backend "http" {}
|
backend "http" {}
|
||||||
required_providers {
|
required_providers {
|
||||||
gitlab {
|
gitlab = {
|
||||||
source = "gitlabhq/gitlab"
|
source = "gitlabhq/gitlab"
|
||||||
verison = "16.2.0"
|
version = "16.2.0"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
provider "gitlab" {
|
provider "gitlab" {
|
||||||
token = var.GITLAB_TOKEN
|
token = var.GITLAB_TOKEN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "gitlab_project" "project" {
|
||||||
|
name = var.GITLAB_PROJECT_NAME
|
||||||
|
allow_merge_on_skipped_pipeline = false
|
||||||
|
only_allow_merge_if_pipeline_succeeds = true
|
||||||
|
remove_source_branch_after_merge = true
|
||||||
|
squash_option = "default_on"
|
||||||
|
ci_config_path = ".gitlab/.gitlab-ci.yml"
|
||||||
|
shared_runners_enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "gitlab_branch_protection" "master" {
|
||||||
|
project = gitlab_project.project.id
|
||||||
|
branch = "main"
|
||||||
|
push_access_level = "maintainer"
|
||||||
|
merge_access_level = "developer"
|
||||||
|
allow_force_push = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "gitlab_branch_protection" "release" {
|
||||||
|
project = gitlab_project.project.id
|
||||||
|
branch = "release/*"
|
||||||
|
push_access_level = "maintainer"
|
||||||
|
merge_access_level = "developer"
|
||||||
|
allow_force_push = false
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "gitlab_project_runner_enablement" "k3s" {
|
||||||
|
project = gitlab_project.project.id
|
||||||
|
runner_id = var.GITLAB_SHARED_RUNNER_ID
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,15 @@
|
|||||||
variable "GITLAB_TOKEN {
|
variable "GITLAB_TOKEN" {
|
||||||
type = string
|
type = string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "GITLAB_PROJECT_ID" {
|
||||||
|
type = number
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "GITLAB_PROJECT_NAME" {
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "GITLAB_SHARED_RUNNER_ID" {
|
||||||
|
type = number
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user