Skip to content

Instantly share code, notes, and snippets.

@SanthoshNC
Created August 24, 2021 08:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save SanthoshNC/2310aac8405f25e77c97b89980255a6c to your computer and use it in GitHub Desktop.
# 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