published on Monday, Mar 9, 2026 by Pulumi
published on Monday, Mar 9, 2026 by Pulumi
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
using System.Collections.Generic;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
// Add a deploy key
var exampleRepositoryDeployKey = new Github.RepositoryDeployKey("exampleRepositoryDeployKey", new()
{
Key = "ssh-rsa AAA...",
ReadOnly = false,
Repository = "test-repo",
Title = "Repository test key",
});
});
package main
import (
"github.com/pulumi/pulumi-github/sdk/v4/go/github"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := github.NewRepositoryDeployKey(ctx, "exampleRepositoryDeployKey", &github.RepositoryDeployKeyArgs{
Key: pulumi.String("ssh-rsa AAA..."),
ReadOnly: pulumi.Bool(false),
Repository: pulumi.String("test-repo"),
Title: pulumi.String("Repository test key"),
})
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.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) {
var exampleRepositoryDeployKey = new RepositoryDeployKey("exampleRepositoryDeployKey", RepositoryDeployKeyArgs.builder()
.key("ssh-rsa AAA...")
.readOnly("false")
.repository("test-repo")
.title("Repository test key")
.build());
}
}
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
// Add a deploy key
const exampleRepositoryDeployKey = new github.RepositoryDeployKey("example_repository_deploy_key", {
key: "ssh-rsa AAA...",
readOnly: false,
repository: "test-repo",
title: "Repository test key",
});
import pulumi
import pulumi_github as github
# Add a deploy key
example_repository_deploy_key = github.RepositoryDeployKey("exampleRepositoryDeployKey",
key="ssh-rsa AAA...",
read_only=False,
repository="test-repo",
title="Repository test key")
resources:
# Add a deploy key
exampleRepositoryDeployKey:
type: github:RepositoryDeployKey
properties:
key: ssh-rsa AAA...
readOnly: false
repository: test-repo
title: Repository test key
Create RepositoryDeployKey Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RepositoryDeployKey(name: string, args: RepositoryDeployKeyArgs, opts?: CustomResourceOptions);@overload
def RepositoryDeployKey(resource_name: str,
args: RepositoryDeployKeyArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RepositoryDeployKey(resource_name: str,
opts: Optional[ResourceOptions] = None,
key: Optional[str] = None,
repository: Optional[str] = None,
title: Optional[str] = None,
read_only: Optional[bool] = None)func NewRepositoryDeployKey(ctx *Context, name string, args RepositoryDeployKeyArgs, opts ...ResourceOption) (*RepositoryDeployKey, error)public RepositoryDeployKey(string name, RepositoryDeployKeyArgs args, CustomResourceOptions? opts = null)
public RepositoryDeployKey(String name, RepositoryDeployKeyArgs args)
public RepositoryDeployKey(String name, RepositoryDeployKeyArgs args, CustomResourceOptions options)
type: github:RepositoryDeployKey
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args RepositoryDeployKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args RepositoryDeployKeyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RepositoryDeployKeyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RepositoryDeployKeyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RepositoryDeployKeyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var repositoryDeployKeyResource = new Github.RepositoryDeployKey("repositoryDeployKeyResource", new()
{
Key = "string",
Repository = "string",
Title = "string",
ReadOnly = false,
});
example, err := github.NewRepositoryDeployKey(ctx, "repositoryDeployKeyResource", &github.RepositoryDeployKeyArgs{
Key: pulumi.String("string"),
Repository: pulumi.String("string"),
Title: pulumi.String("string"),
ReadOnly: pulumi.Bool(false),
})
var repositoryDeployKeyResource = new RepositoryDeployKey("repositoryDeployKeyResource", RepositoryDeployKeyArgs.builder()
.key("string")
.repository("string")
.title("string")
.readOnly(false)
.build());
repository_deploy_key_resource = github.RepositoryDeployKey("repositoryDeployKeyResource",
key="string",
repository="string",
title="string",
read_only=False)
const repositoryDeployKeyResource = new github.RepositoryDeployKey("repositoryDeployKeyResource", {
key: "string",
repository: "string",
title: "string",
readOnly: false,
});
type: github:RepositoryDeployKey
properties:
key: string
readOnly: false
repository: string
title: string
RepositoryDeployKey Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The RepositoryDeployKey resource accepts the following input properties:
- Key string
- A SSH key.
- Repository string
- Name of the GitHub repository.
- Title string
- A title.
- Read
Only bool - A boolean qualifying the key to be either read only or read/write.
- Key string
- A SSH key.
- Repository string
- Name of the GitHub repository.
- Title string
- A title.
- Read
Only bool - A boolean qualifying the key to be either read only or read/write.
- key String
- A SSH key.
- repository String
- Name of the GitHub repository.
- title String
- A title.
- read
Only Boolean - A boolean qualifying the key to be either read only or read/write.
- key string
- A SSH key.
- repository string
- Name of the GitHub repository.
- title string
- A title.
- read
Only boolean - A boolean qualifying the key to be either read only or read/write.
- key str
- A SSH key.
- repository str
- Name of the GitHub repository.
- title str
- A title.
- read_
only bool - A boolean qualifying the key to be either read only or read/write.
- key String
- A SSH key.
- repository String
- Name of the GitHub repository.
- title String
- A title.
- read
Only Boolean - A boolean qualifying the key to be either read only or read/write.
Outputs
All input properties are implicitly available as output properties. Additionally, the RepositoryDeployKey resource produces the following output properties:
Look up Existing RepositoryDeployKey Resource
Get an existing RepositoryDeployKey resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: RepositoryDeployKeyState, opts?: CustomResourceOptions): RepositoryDeployKey@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
etag: Optional[str] = None,
key: Optional[str] = None,
read_only: Optional[bool] = None,
repository: Optional[str] = None,
title: Optional[str] = None) -> RepositoryDeployKeyfunc GetRepositoryDeployKey(ctx *Context, name string, id IDInput, state *RepositoryDeployKeyState, opts ...ResourceOption) (*RepositoryDeployKey, error)public static RepositoryDeployKey Get(string name, Input<string> id, RepositoryDeployKeyState? state, CustomResourceOptions? opts = null)public static RepositoryDeployKey get(String name, Output<String> id, RepositoryDeployKeyState state, CustomResourceOptions options)resources: _: type: github:RepositoryDeployKey get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Etag string
- Key string
- A SSH key.
- Read
Only bool - A boolean qualifying the key to be either read only or read/write.
- Repository string
- Name of the GitHub repository.
- Title string
- A title.
- Etag string
- Key string
- A SSH key.
- Read
Only bool - A boolean qualifying the key to be either read only or read/write.
- Repository string
- Name of the GitHub repository.
- Title string
- A title.
- etag String
- key String
- A SSH key.
- read
Only Boolean - A boolean qualifying the key to be either read only or read/write.
- repository String
- Name of the GitHub repository.
- title String
- A title.
- etag string
- key string
- A SSH key.
- read
Only boolean - A boolean qualifying the key to be either read only or read/write.
- repository string
- Name of the GitHub repository.
- title string
- A title.
- etag str
- key str
- A SSH key.
- read_
only bool - A boolean qualifying the key to be either read only or read/write.
- repository str
- Name of the GitHub repository.
- title str
- A title.
- etag String
- key String
- A SSH key.
- read
Only Boolean - A boolean qualifying the key to be either read only or read/write.
- repository String
- Name of the GitHub repository.
- title String
- A title.
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
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- GitHub pulumi/pulumi-github
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
githubTerraform Provider.
published on Monday, Mar 9, 2026 by Pulumi
