This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gitlab_provider.tf | |
terraform { | |
required_providers { | |
gitlab = { | |
source = "gitlabhq/gitlab" | |
} | |
} | |
} | |
# Configure the GitLab Provider | |
provider "gitlab" { | |
} | |
# gitlab_resources.tf | |
# Add a project owned by the user | |
resource "gitlab_project" "tf_project" { | |
name = var.project_name | |
description = "A sample Repo created using TF" | |
visibility_level = "public" | |
} | |
# Add a variable to the project | |
resource "gitlab_project_variable" "tf_project_variable" { | |
project = gitlab_project.tf_project.id | |
key = "project_variable_key" | |
value = "project_variable_value" | |
protected = false | |
} | |
# variables.tf | |
variable "project_name" { | |
description = "Value of the name for the GitLab Project" | |
type = string | |
default = "tf_project" | |
} | |
# outputs.tf | |
output "project_id" { | |
description = "ID of the GitLab Project" | |
value = gitlab_project.tf_project.id | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment