Cluster Agent Args
data class ClusterAgentArgs(val name: Output<String>? = null, val project: Output<String>? = null) : ConvertibleToJava<ClusterAgentArgs>
The gitlab.ClusterAgent
resource allows to manage the lifecycle of a GitLab Agent for Kubernetes.
Note that this resource only registers the agent, but doesn't configure it. The configuration needs to be manually added as described in the docs. However, a
gitlab.RepositoryFile
resource may be used to achieve that. Requires at least maintainer permissions on the project. Requires at least GitLab 14.10 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.ClusterAgent;
import com.pulumi.gitlab.ClusterAgentArgs;
import com.pulumi.gitlab.RepositoryFile;
import com.pulumi.gitlab.RepositoryFileArgs;
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 ClusterAgent("example", ClusterAgentArgs.builder()
.project("12345")
.build());
var exampleAgentConfig = new RepositoryFile("exampleAgentConfig", RepositoryFileArgs.builder()
.project(example.project())
.branch("main")
.filePath(example.name().applyValue(name -> String.format(".gitlab/agents/%s", name)))
.content("""
gitops:
...
""")
.authorEmail("terraform@example.com")
.authorName("Terraform")
.commitMessage(example.name().applyValue(name -> String.format("feature: add agent config for %s", name)))
.build());
}
}
Content copied to clipboard
Import
GitLab Agent for Kubernetes can be imported with the following command and the id pattern <project>:<agent-id>
$ pulumi import gitlab:index/clusterAgent:ClusterAgent example '12345:42'
Content copied to clipboard