RepositoryDeployKeyArgs

data class RepositoryDeployKeyArgs(val key: Output<String>? = null, val readOnly: Output<Boolean>? = null, val repository: Output<String>? = null, val title: Output<String>? = null) : ConvertibleToJava<RepositoryDeployKeyArgs>

Provides a GitHub repository deploy key resource. A deploy key is an SSH key that is stored on your server and grants access to a single GitHub repository. This key is attached directly to the repository instead of to a personal user account. This resource allows you to add/remove repository deploy keys. Further documentation on GitHub repository deploy keys:

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
import * as tls from "@pulumi/tls";
// Generate an ssh key using provider "hashicorp/tls"
const exampleRepositoryDeployKey = new tls.PrivateKey("example_repository_deploy_key", {algorithm: "ED25519"});
// Add the ssh key as a deploy key
const exampleRepositoryDeployKeyRepositoryDeployKey = new github.RepositoryDeployKey("example_repository_deploy_key", {
title: "Repository test key",
repository: "test-repo",
key: exampleRepositoryDeployKey.publicKeyOpenssh,
readOnly: true,
});
import pulumi
import pulumi_github as github
import pulumi_tls as tls
# Generate an ssh key using provider "hashicorp/tls"
example_repository_deploy_key = tls.PrivateKey("example_repository_deploy_key", algorithm="ED25519")
# Add the ssh key as a deploy key
example_repository_deploy_key_repository_deploy_key = github.RepositoryDeployKey("example_repository_deploy_key",
title="Repository test key",
repository="test-repo",
key=example_repository_deploy_key.public_key_openssh,
read_only=True)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
using Tls = Pulumi.Tls;
return await Deployment.RunAsync(() =>
{
// Generate an ssh key using provider "hashicorp/tls"
var exampleRepositoryDeployKey = new Tls.PrivateKey("example_repository_deploy_key", new()
{
Algorithm = "ED25519",
});
// Add the ssh key as a deploy key
var exampleRepositoryDeployKeyRepositoryDeployKey = new Github.RepositoryDeployKey("example_repository_deploy_key", new()
{
Title = "Repository test key",
Repository = "test-repo",
Key = exampleRepositoryDeployKey.PublicKeyOpenssh,
ReadOnly = true,
});
});
package main
import (
"github.com/pulumi/pulumi-github/sdk/v6/go/github"
"github.com/pulumi/pulumi-tls/sdk/v5/go/tls"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Generate an ssh key using provider "hashicorp/tls"
exampleRepositoryDeployKey, err := tls.NewPrivateKey(ctx, "example_repository_deploy_key", &tls.PrivateKeyArgs{
Algorithm: pulumi.String("ED25519"),
})
if err != nil {
return err
}
// Add the ssh key as a deploy key
_, err = github.NewRepositoryDeployKey(ctx, "example_repository_deploy_key", &github.RepositoryDeployKeyArgs{
Title: pulumi.String("Repository test key"),
Repository: pulumi.String("test-repo"),
Key: exampleRepositoryDeployKey.PublicKeyOpenssh,
ReadOnly: pulumi.Bool(true),
})
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.tls.PrivateKey;
import com.pulumi.tls.PrivateKeyArgs;
import com.pulumi.github.RepositoryDeployKey;
import com.pulumi.github.RepositoryDeployKeyArgs;
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) {
// Generate an ssh key using provider "hashicorp/tls"
var exampleRepositoryDeployKey = new PrivateKey("exampleRepositoryDeployKey", PrivateKeyArgs.builder()
.algorithm("ED25519")
.build());
// Add the ssh key as a deploy key
var exampleRepositoryDeployKeyRepositoryDeployKey = new RepositoryDeployKey("exampleRepositoryDeployKeyRepositoryDeployKey", RepositoryDeployKeyArgs.builder()
.title("Repository test key")
.repository("test-repo")
.key(exampleRepositoryDeployKey.publicKeyOpenssh())
.readOnly(true)
.build());
}
}
resources:
# Generate an ssh key using provider "hashicorp/tls"
exampleRepositoryDeployKey:
type: tls:PrivateKey
name: example_repository_deploy_key
properties:
algorithm: ED25519
# Add the ssh key as a deploy key
exampleRepositoryDeployKeyRepositoryDeployKey:
type: github:RepositoryDeployKey
name: example_repository_deploy_key
properties:
title: Repository test key
repository: test-repo
key: ${exampleRepositoryDeployKey.publicKeyOpenssh}
readOnly: true

Import

Repository deploy keys can be imported using a colon-separated pair of repository name and GitHub's key id. The latter can be obtained by GitHub's SDKs and API.

$ pulumi import github:index/repositoryDeployKey:RepositoryDeployKey foo test-repo:23824728

Constructors

Link copied to clipboard
constructor(key: Output<String>? = null, readOnly: Output<Boolean>? = null, repository: Output<String>? = null, title: Output<String>? = null)

Properties

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

A SSH key.

Link copied to clipboard
val readOnly: Output<Boolean>? = null

A boolean qualifying the key to be either read only or read/write.

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

Name of the GitHub repository.

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

A title. Changing any of the fields forces re-creating the resource.

Functions

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