Add `gitlab_cluster_agent_token` resource
Created by: longuniquename
Feature Description
The current GitLab provider for Terraform (3.15.1) does not support token creation for cluster agents.
It would be nice to have something like:
resource "gitlab_cluster_agent_token" "example" {
agent_id = "default"
name = "token-tf"
description = "terraform managed token"
}
Upstream API to cover: https://docs.gitlab.com/ee/api/cluster_agents.html#create-an-agent-token
Use case
We'd like to create a k8s cluster with terraform and add it to an existing gitlab project. We already can create cluster agent in the project and deploy gitlab cluster agent to the k8s cluster. The only missing piece is creating the token and passing it to cluster agent helm chart variables.
resource "helm_release" "gitlab_agent" {
name = "gitlab-agent"
namespace = "gitlab-agent"
create_namespace = true
repository = "https://charts.gitlab.io"
chart = "gitlab-agent"
version = "0.6.1"
set {
name = "config.token"
value = gitlab_cluster_agent_token.example.token
}
}