UserSshKeyArgs

data class UserSshKeyArgs(val expiresAt: Output<String>? = null, val key: Output<String>? = null, val title: Output<String>? = null, val userId: Output<Int>? = null) : ConvertibleToJava<UserSshKeyArgs>

The gitlab.UserSshKey resource allows to manage the lifecycle of an SSH key assigned to a user. Upstream API: GitLab API docs

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const example = gitlab.getUser({
username: "example-user",
});
const exampleUserSshKey = new gitlab.UserSshKey("example", {
userId: example.then(example => example.id),
title: "example-key",
key: "ssh-ed25519 AAAA...",
expiresAt: "2016-01-21T00:00:00.000Z",
});
import pulumi
import pulumi_gitlab as gitlab
example = gitlab.get_user(username="example-user")
example_user_ssh_key = gitlab.UserSshKey("example",
user_id=example.id,
title="example-key",
key="ssh-ed25519 AAAA...",
expires_at="2016-01-21T00:00:00.000Z")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() =>
{
var example = GitLab.GetUser.Invoke(new()
{
Username = "example-user",
});
var exampleUserSshKey = new GitLab.UserSshKey("example", new()
{
UserId = example.Apply(getUserResult => getUserResult.Id),
Title = "example-key",
Key = "ssh-ed25519 AAAA...",
ExpiresAt = "2016-01-21T00:00:00.000Z",
});
});
package main
import (
"github.com/pulumi/pulumi-gitlab/sdk/v7/go/gitlab"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := gitlab.LookupUser(ctx, &gitlab.LookupUserArgs{
Username: pulumi.StringRef("example-user"),
}, nil)
if err != nil {
return err
}
_, err = gitlab.NewUserSshKey(ctx, "example", &gitlab.UserSshKeyArgs{
UserId: pulumi.String(example.Id),
Title: pulumi.String("example-key"),
Key: pulumi.String("ssh-ed25519 AAAA..."),
ExpiresAt: pulumi.String("2016-01-21T00:00:00.000Z"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.GitlabFunctions;
import com.pulumi.gitlab.inputs.GetUserArgs;
import com.pulumi.gitlab.UserSshKey;
import com.pulumi.gitlab.UserSshKeyArgs;
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) {
final var example = GitlabFunctions.getUser(GetUserArgs.builder()
.username("example-user")
.build());
var exampleUserSshKey = new UserSshKey("exampleUserSshKey", UserSshKeyArgs.builder()
.userId(example.applyValue(getUserResult -> getUserResult.id()))
.title("example-key")
.key("ssh-ed25519 AAAA...")
.expiresAt("2016-01-21T00:00:00.000Z")
.build());
}
}
resources:
exampleUserSshKey:
type: gitlab:UserSshKey
name: example
properties:
userId: ${example.id}
title: example-key
key: ssh-ed25519 AAAA...
expiresAt: 2016-01-21T00:00:00.000Z
variables:
example:
fn::invoke:
Function: gitlab:getUser
Arguments:
username: example-user

Import

You can import a user ssh key using an id made up of {user-id}:{key}, e.g.

$ pulumi import gitlab:index/userSshKey:UserSshKey example 42:1

Constructors

Link copied to clipboard
constructor(expiresAt: Output<String>? = null, key: Output<String>? = null, title: Output<String>? = null, userId: Output<Int>? = null)

Properties

Link copied to clipboard
val expiresAt: Output<String>? = null

The expiration date of the SSH key in ISO 8601 format (YYYY-MM-DDTHH:MM:SSZ)

Link copied to clipboard
val key: Output<String>? = null

The ssh key. The SSH key comment (trailing part) is optional and ignored for diffing, because GitLab overrides it with the username and GitLab hostname.

Link copied to clipboard
val title: Output<String>? = null

The title of the ssh key.

Link copied to clipboard
val userId: Output<Int>? = null

The ID or username of the user. If this field is omitted, this resource manages a SSH key for the current user. Otherwise, this resource manages a SSH key for the specified user, and an admin token is required.

Functions

Link copied to clipboard
open override fun toJava(): UserSshKeyArgs