Report this

What is the reason for this report?

how to setup gitlab to create repositories

Posted on December 15, 2021

this not work(((

file: create.tf #####################

terraform {   required_providers {     gitlab = {       source = “gitlabhq/gitlab”     }   } } variable “gitlab_token” {   type = string   default = “SECRET” } variable “base_url” {   type = string   default = “https://gitlab.com/errooorr/api/v4/” } provider “gitlab” {     token = var.gitlab_token     base_url = var.base_url ########################

and

file: terraform.tfvars

############

gitlab_token = blablabla



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Heya,

From what you have provided there could be a couple of issues.

  1. Incorrect base_url - The base_url you provided looks a bit strange. Usually, for GitLab, it’s https://gitlab.com/api/v4/. You have “errooorr” in the middle of your URL which is incorrect.

  2. Spacing and Indentation - Consistent spacing and indentation are crucial for Terraform to interpret the configuration correctly.

Here’s a cleaner version of your create.tf:

terraform {
  required_providers {
    gitlab = {
      source = "gitlabhq/gitlab"
    }
  }
}

variable "gitlab_token" {
  description = "Token for accessing GitLab API"
  type        = string
  default     = ""  # Empty default, it's best to provide this via tfvars or environment variables
}

variable "base_url" {
  description = "Base URL for GitLab API"
  type        = string
  default     = "https://gitlab.com/api/v4/"
}

provider "gitlab" {
  token    = var.gitlab_token
  base_url = var.base_url
}

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.