1. Packages
  2. Github Provider
  3. API Docs
  4. UserSshKey
GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi

github.UserSshKey

Explore with Pulumi AI

github logo
GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi

    Provides a GitHub user’s SSH key resource.

    This resource allows you to add/remove SSH keys from your user account.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    import * as std from "@pulumi/std";
    
    const example = new github.UserSshKey("example", {
        title: "example title",
        key: std.file({
            input: "~/.ssh/id_rsa.pub",
        }).then(invoke => invoke.result),
    });
    
    import pulumi
    import pulumi_github as github
    import pulumi_std as std
    
    example = github.UserSshKey("example",
        title="example title",
        key=std.file(input="~/.ssh/id_rsa.pub").result)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v6/go/github"
    	"github.com/pulumi/pulumi-std/sdk/go/std"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		invokeFile, err := std.File(ctx, &std.FileArgs{
    			Input: "~/.ssh/id_rsa.pub",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = github.NewUserSshKey(ctx, "example", &github.UserSshKeyArgs{
    			Title: pulumi.String("example title"),
    			Key:   pulumi.String(invokeFile.Result),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    using Std = Pulumi.Std;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Github.UserSshKey("example", new()
        {
            Title = "example title",
            Key = Std.File.Invoke(new()
            {
                Input = "~/.ssh/id_rsa.pub",
            }).Apply(invoke => invoke.Result),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.github.UserSshKey;
    import com.pulumi.github.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) {
            var example = new UserSshKey("example", UserSshKeyArgs.builder()
                .title("example title")
                .key(StdFunctions.file(FileArgs.builder()
                    .input("~/.ssh/id_rsa.pub")
                    .build()).result())
                .build());
    
        }
    }
    
    resources:
      example:
        type: github:UserSshKey
        properties:
          title: example title
          key:
            fn::invoke:
              Function: std:file
              Arguments:
                input: ~/.ssh/id_rsa.pub
              Return: result
    

    Create UserSshKey Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new UserSshKey(name: string, args: UserSshKeyArgs, opts?: CustomResourceOptions);
    @overload
    def UserSshKey(resource_name: str,
                   args: UserSshKeyArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def UserSshKey(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   key: Optional[str] = None,
                   title: Optional[str] = None)
    func NewUserSshKey(ctx *Context, name string, args UserSshKeyArgs, opts ...ResourceOption) (*UserSshKey, error)
    public UserSshKey(string name, UserSshKeyArgs args, CustomResourceOptions? opts = null)
    public UserSshKey(String name, UserSshKeyArgs args)
    public UserSshKey(String name, UserSshKeyArgs args, CustomResourceOptions options)
    
    type: github:UserSshKey
    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 UserSshKeyArgs
    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 UserSshKeyArgs
    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 UserSshKeyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args UserSshKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args UserSshKeyArgs
    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 userSshKeyResource = new Github.UserSshKey("userSshKeyResource", new()
    {
        Key = "string",
        Title = "string",
    });
    
    example, err := github.NewUserSshKey(ctx, "userSshKeyResource", &github.UserSshKeyArgs{
    	Key:   pulumi.String("string"),
    	Title: pulumi.String("string"),
    })
    
    var userSshKeyResource = new UserSshKey("userSshKeyResource", UserSshKeyArgs.builder()
        .key("string")
        .title("string")
        .build());
    
    user_ssh_key_resource = github.UserSshKey("userSshKeyResource",
        key="string",
        title="string")
    
    const userSshKeyResource = new github.UserSshKey("userSshKeyResource", {
        key: "string",
        title: "string",
    });
    
    type: github:UserSshKey
    properties:
        key: string
        title: string
    

    UserSshKey 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 UserSshKey resource accepts the following input properties:

    Key string
    The public SSH key to add to your GitHub account.
    Title string
    A descriptive name for the new key. e.g. Personal MacBook Air
    Key string
    The public SSH key to add to your GitHub account.
    Title string
    A descriptive name for the new key. e.g. Personal MacBook Air
    key String
    The public SSH key to add to your GitHub account.
    title String
    A descriptive name for the new key. e.g. Personal MacBook Air
    key string
    The public SSH key to add to your GitHub account.
    title string
    A descriptive name for the new key. e.g. Personal MacBook Air
    key str
    The public SSH key to add to your GitHub account.
    title str
    A descriptive name for the new key. e.g. Personal MacBook Air
    key String
    The public SSH key to add to your GitHub account.
    title String
    A descriptive name for the new key. e.g. Personal MacBook Air

    Outputs

    All input properties are implicitly available as output properties. Additionally, the UserSshKey resource produces the following output properties:

    Etag string
    Id string
    The provider-assigned unique ID for this managed resource.
    Url string
    The URL of the SSH key
    Etag string
    Id string
    The provider-assigned unique ID for this managed resource.
    Url string
    The URL of the SSH key
    etag String
    id String
    The provider-assigned unique ID for this managed resource.
    url String
    The URL of the SSH key
    etag string
    id string
    The provider-assigned unique ID for this managed resource.
    url string
    The URL of the SSH key
    etag str
    id str
    The provider-assigned unique ID for this managed resource.
    url str
    The URL of the SSH key
    etag String
    id String
    The provider-assigned unique ID for this managed resource.
    url String
    The URL of the SSH key

    Look up Existing UserSshKey Resource

    Get an existing UserSshKey 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?: UserSshKeyState, opts?: CustomResourceOptions): UserSshKey
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            etag: Optional[str] = None,
            key: Optional[str] = None,
            title: Optional[str] = None,
            url: Optional[str] = None) -> UserSshKey
    func GetUserSshKey(ctx *Context, name string, id IDInput, state *UserSshKeyState, opts ...ResourceOption) (*UserSshKey, error)
    public static UserSshKey Get(string name, Input<string> id, UserSshKeyState? state, CustomResourceOptions? opts = null)
    public static UserSshKey get(String name, Output<String> id, UserSshKeyState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    Etag string
    Key string
    The public SSH key to add to your GitHub account.
    Title string
    A descriptive name for the new key. e.g. Personal MacBook Air
    Url string
    The URL of the SSH key
    Etag string
    Key string
    The public SSH key to add to your GitHub account.
    Title string
    A descriptive name for the new key. e.g. Personal MacBook Air
    Url string
    The URL of the SSH key
    etag String
    key String
    The public SSH key to add to your GitHub account.
    title String
    A descriptive name for the new key. e.g. Personal MacBook Air
    url String
    The URL of the SSH key
    etag string
    key string
    The public SSH key to add to your GitHub account.
    title string
    A descriptive name for the new key. e.g. Personal MacBook Air
    url string
    The URL of the SSH key
    etag str
    key str
    The public SSH key to add to your GitHub account.
    title str
    A descriptive name for the new key. e.g. Personal MacBook Air
    url str
    The URL of the SSH key
    etag String
    key String
    The public SSH key to add to your GitHub account.
    title String
    A descriptive name for the new key. e.g. Personal MacBook Air
    url String
    The URL of the SSH key

    Import

    SSH keys can be imported using their ID e.g.

    $ pulumi import github:index/userSshKey:UserSshKey example 1234567
    

    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 github Terraform Provider.
    github logo
    GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi