1. Packages
  2. Civo
  3. API Docs
  4. SshKey
Civo v2.3.13 published on Friday, Jan 19, 2024 by Pulumi

civo.SshKey

Explore with Pulumi AI

civo logo
Civo v2.3.13 published on Friday, Jan 19, 2024 by Pulumi

    Provides a Civo SSH key resource to allow you to manage SSH keys for instance access. Keys created with this resource can be referenced in your instance configuration via their ID.

    Example Usage

    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using Pulumi;
    using Civo = Pulumi.Civo;
    
    return await Deployment.RunAsync(() => 
    {
        var my_user = new Civo.SshKey("my-user", new()
        {
            PublicKey = File.ReadAllText("~/.ssh/id_rsa.pub"),
        });
    
    });
    
    package main
    
    import (
    	"os"
    
    	"github.com/pulumi/pulumi-civo/sdk/v2/go/civo"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func readFileOrPanic(path string) pulumi.StringPtrInput {
    	data, err := os.ReadFile(path)
    	if err != nil {
    		panic(err.Error())
    	}
    	return pulumi.String(string(data))
    }
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := civo.NewSshKey(ctx, "my-user", &civo.SshKeyArgs{
    			PublicKey: readFileOrPanic("~/.ssh/id_rsa.pub"),
    		})
    		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.civo.SshKey;
    import com.pulumi.civo.SshKeyArgs;
    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 my_user = new SshKey("my-user", SshKeyArgs.builder()        
                .publicKey(Files.readString(Paths.get("~/.ssh/id_rsa.pub")))
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_civo as civo
    
    my_user = civo.SshKey("my-user", public_key=(lambda path: open(path).read())("~/.ssh/id_rsa.pub"))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as civo from "@pulumi/civo";
    import * as fs from "fs";
    
    const my_user = new civo.SshKey("my-user", {publicKey: fs.readFileSync("~/.ssh/id_rsa.pub", "utf8")});
    
    resources:
      my-user:
        type: civo:SshKey
        properties:
          publicKey:
            fn::readFile: ~/.ssh/id_rsa.pub
    

    Create SshKey Resource

    new SshKey(name: string, args: SshKeyArgs, opts?: CustomResourceOptions);
    @overload
    def SshKey(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               name: Optional[str] = None,
               public_key: Optional[str] = None)
    @overload
    def SshKey(resource_name: str,
               args: SshKeyArgs,
               opts: Optional[ResourceOptions] = None)
    func NewSshKey(ctx *Context, name string, args SshKeyArgs, opts ...ResourceOption) (*SshKey, error)
    public SshKey(string name, SshKeyArgs args, CustomResourceOptions? opts = null)
    public SshKey(String name, SshKeyArgs args)
    public SshKey(String name, SshKeyArgs args, CustomResourceOptions options)
    
    type: civo:SshKey
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args SshKeyArgs
    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 SshKeyArgs
    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 SshKeyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SshKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SshKeyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    SshKey Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The SshKey resource accepts the following input properties:

    PublicKey string
    a string containing the SSH public key.
    Name string
    a string that will be the reference for the SSH key.
    PublicKey string
    a string containing the SSH public key.
    Name string
    a string that will be the reference for the SSH key.
    publicKey String
    a string containing the SSH public key.
    name String
    a string that will be the reference for the SSH key.
    publicKey string
    a string containing the SSH public key.
    name string
    a string that will be the reference for the SSH key.
    public_key str
    a string containing the SSH public key.
    name str
    a string that will be the reference for the SSH key.
    publicKey String
    a string containing the SSH public key.
    name String
    a string that will be the reference for the SSH key.

    Outputs

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

    Fingerprint string
    a string containing the SSH finger print.
    Id string
    The provider-assigned unique ID for this managed resource.
    Fingerprint string
    a string containing the SSH finger print.
    Id string
    The provider-assigned unique ID for this managed resource.
    fingerprint String
    a string containing the SSH finger print.
    id String
    The provider-assigned unique ID for this managed resource.
    fingerprint string
    a string containing the SSH finger print.
    id string
    The provider-assigned unique ID for this managed resource.
    fingerprint str
    a string containing the SSH finger print.
    id str
    The provider-assigned unique ID for this managed resource.
    fingerprint String
    a string containing the SSH finger print.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing SshKey Resource

    Get an existing SshKey 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?: SshKeyState, opts?: CustomResourceOptions): SshKey
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            fingerprint: Optional[str] = None,
            name: Optional[str] = None,
            public_key: Optional[str] = None) -> SshKey
    func GetSshKey(ctx *Context, name string, id IDInput, state *SshKeyState, opts ...ResourceOption) (*SshKey, error)
    public static SshKey Get(string name, Input<string> id, SshKeyState? state, CustomResourceOptions? opts = null)
    public static SshKey get(String name, Output<String> id, SshKeyState 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:
    Fingerprint string
    a string containing the SSH finger print.
    Name string
    a string that will be the reference for the SSH key.
    PublicKey string
    a string containing the SSH public key.
    Fingerprint string
    a string containing the SSH finger print.
    Name string
    a string that will be the reference for the SSH key.
    PublicKey string
    a string containing the SSH public key.
    fingerprint String
    a string containing the SSH finger print.
    name String
    a string that will be the reference for the SSH key.
    publicKey String
    a string containing the SSH public key.
    fingerprint string
    a string containing the SSH finger print.
    name string
    a string that will be the reference for the SSH key.
    publicKey string
    a string containing the SSH public key.
    fingerprint str
    a string containing the SSH finger print.
    name str
    a string that will be the reference for the SSH key.
    public_key str
    a string containing the SSH public key.
    fingerprint String
    a string containing the SSH finger print.
    name String
    a string that will be the reference for the SSH key.
    publicKey String
    a string containing the SSH public key.

    Import

    using ID

     $ pulumi import civo:index/sshKey:SshKey mykey 87ca2ee4-57d3-4420-b9b6-411b0b4b2a0e
    

    Package Details

    Repository
    Civo pulumi/pulumi-civo
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the civo Terraform Provider.
    civo logo
    Civo v2.3.13 published on Friday, Jan 19, 2024 by Pulumi