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.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hi there,
It looks like you haven’t closed your
provider
block. Yourcreate.tf
file should be like the following:Your
terraform.tfvars
file is correctly set up. The terraform variables file should be like this:Ensure you replace
"blablabla"
with your actual GitLab token.A couple of other points to consider:
Check that your
base_url
is correct. The base url should be the GitLab API endpoint. The usual endpoint for GitLab’s API ishttps://gitlab.com/api/v4/
.Ensure you have installed the correct GitLab provider. You can do this by running the following command in the directory where your .tf files are located:
After setting the correct values and making sure everything is correctly set up, apply your configuration by running:
If you have sensitive data like tokens, it’s not recommended to put the real values directly in the scripts or code. Use secrets management tools to handle such information.
Check your GitLab token permissions. It should have the necessary permissions for the operations you are trying to perform.
I could also suggest going over the official documentation here: