Cluster Agent Token Args
data class ClusterAgentTokenArgs(val agentId: Output<Int>? = null, val description: Output<String>? = null, val name: Output<String>? = null, val project: Output<String>? = null) : ConvertibleToJava<ClusterAgentTokenArgs>
The gitlab.ClusterAgentToken
resource allows to manage the lifecycle of a token for a GitLab Agent for Kubernetes.
Requires at least maintainer permissions on the project. Requires at least GitLab 15.0 Upstream API: GitLab REST API docs
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.ClusterAgentToken;
import com.pulumi.gitlab.ClusterAgentTokenArgs;
import com.pulumi.gitlab.GitlabFunctions;
import com.pulumi.gitlab.inputs.GetProjectArgs;
import com.pulumi.gitlab.ClusterAgent;
import com.pulumi.gitlab.ClusterAgentArgs;
import com.pulumi.helm.helm_release;
import com.pulumi.helm.Helm_releaseArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new ClusterAgentToken("example", ClusterAgentTokenArgs.builder()
.project("12345")
.agentId(42)
.description("some token")
.build());
final var thisProject = GitlabFunctions.getProject(GetProjectArgs.builder()
.pathWithNamespace("my-org/example")
.build());
var thisClusterAgent = new ClusterAgent("thisClusterAgent", ClusterAgentArgs.builder()
.project(thisProject.applyValue(getProjectResult -> getProjectResult.id()))
.build());
var thisClusterAgentToken = new ClusterAgentToken("thisClusterAgentToken", ClusterAgentTokenArgs.builder()
.project(thisProject.applyValue(getProjectResult -> getProjectResult.id()))
.agentId(thisClusterAgent.agentId())
.description("Token for the my-agent used with `gitlab-agent` Helm Chart")
.build());
var gitlabAgent = new Helm_release("gitlabAgent", Helm_releaseArgs.builder()
.name("gitlab-agent")
.namespace("gitlab-agent")
.createNamespace(true)
.repository("https://charts.gitlab.io")
.chart("gitlab-agent")
.version("1.2.0")
.set(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
.build());
}
}
Content copied to clipboard
Import
A token for a GitLab Agent for Kubernetes can be imported with the following command and the id pattern <project>:<agent-id>:<token-id>
$ pulumi import gitlab:index/clusterAgentToken:ClusterAgentToken example '12345:42:1'
Content copied to clipboard
ATTENTIONthe token
resource attribute is not available for imported resources as this information cannot be read from the GitLab API.
Constructors
Link copied to clipboard
fun ClusterAgentTokenArgs(agentId: Output<Int>? = null, description: Output<String>? = null, name: Output<String>? = null, project: Output<String>? = null)