1. Packages
  2. Equinix
  3. API Docs
  4. metal
  5. SshKey
Equinix v0.8.0 published on Tuesday, Apr 2, 2024 by Equinix

equinix.metal.SshKey

Explore with Pulumi AI

equinix logo
Equinix v0.8.0 published on Tuesday, Apr 2, 2024 by Equinix

    Provides a resource to manage User SSH keys on your Equinix Metal user account. If you create a new device in a project, all the keys of the project’s collaborators will be injected to the device.

    The link between User SSH key and device is implicit. If you want to make sure that a key will be copied to a device, you must ensure that the device resource depends_on the key resource.

    Example Usage

    using System.Collections.Generic;
    using System.IO;
    using Pulumi;
    using Equinix = Pulumi.Equinix;
    
    return await Deployment.RunAsync(() => 
    {
        var sshKey = new Equinix.Metal.SshKey("sshKey", new()
        {
            Name = "johnKent",
            PublicKey = File.ReadAllText("/Users/John/.ssh/metal_rsa.pub"),
        });
    
        return new Dictionary<string, object?>
        {
            ["sshKeyId"] = sshKey.Id,
        };
    });
    
    package main
    
    import (
    	"os"
    
    	"github.com/equinix/pulumi-equinix/sdk/go/equinix/metal"
    	"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 {
    		sshKey, err := metal.NewSshKey(ctx, "sshKey", &metal.SshKeyArgs{
    			Name:      pulumi.String("johnKent"),
    			PublicKey: readFileOrPanic("/Users/John/.ssh/metal_rsa.pub"),
    		})
    		if err != nil {
    			return err
    		}
    		ctx.Export("sshKeyId", sshKey.ID())
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.equinix.pulumi.metal.SshKey;
    import com.equinix.pulumi.metal.SshKeyArgs;
    
    import java.io.IOException;
    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) {
            String content = null;
            try {
                content = Files.readString(Paths.get("/Users/John/.ssh/metal_rsa.pub"));
            } catch (IOException e) {
                e.printStackTrace();
            }
    
            var sshKey = new SshKey("sshKey", SshKeyArgs.builder()        
                .name("johnKent")
                .publicKey(content)
                .build());
    
            ctx.export("sshKeyId", sshKey.id());
        }
    }
    
    import pulumi
    import pulumi_equinix as equinix
    
    ssh_key = equinix.metal.SshKey("sshKey",
        name="johnKent",
        public_key=(lambda path: open(path).read())("/Users/John/.ssh/metal_rsa.pub"))
    pulumi.export("sshKeyId", ssh_key.id)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as equinix from "@equinix-labs/pulumi-equinix";
    import * as fs from "fs";
    
    const sshKey = new equinix.metal.SshKey("sshKey", {
        name: "johnKent",
        publicKey: fs.readFileSync("/Users/John/.ssh/metal_rsa.pub"),
    });
    export const sshKeyId = sshKey.id;
    
    resources:
      sshKey:
        type: equinix:metal:SshKey
        properties:
          name: johnKent
          publicKey:
            fn::readFile: /Users/John/.ssh/metal_rsa.pub
    outputs:
      sshKeyId: ${sshKey.id}
    

    Create SshKey Resource

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

    Constructor syntax

    new SshKey(name: string, args: SshKeyArgs, opts?: CustomResourceOptions);
    @overload
    def SshKey(resource_name: str,
               args: SshKeyArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def SshKey(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               public_key: Optional[str] = None,
               name: Optional[str] = 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: equinix:metal:SshKey
    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 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.

    Example

    The following reference example uses placeholder values for all input properties.

    var sshKeyResource = new Equinix.Metal.SshKey("sshKeyResource", new()
    {
        PublicKey = "string",
        Name = "string",
    });
    
    example, err := metal.NewSshKey(ctx, "sshKeyResource", &metal.SshKeyArgs{
    	PublicKey: pulumi.String("string"),
    	Name:      pulumi.String("string"),
    })
    
    var sshKeyResource = new SshKey("sshKeyResource", SshKeyArgs.builder()        
        .publicKey("string")
        .name("string")
        .build());
    
    ssh_key_resource = equinix.metal.SshKey("sshKeyResource",
        public_key="string",
        name="string")
    
    const sshKeyResource = new equinix.metal.SshKey("sshKeyResource", {
        publicKey: "string",
        name: "string",
    });
    
    type: equinix:metal:SshKey
    properties:
        name: string
        publicKey: string
    

    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
    The public key. If this is a file, it can be read using the file interpolation function
    Name string
    The name of the SSH key for identification
    PublicKey string
    The public key. If this is a file, it can be read using the file interpolation function
    Name string
    The name of the SSH key for identification
    publicKey String
    The public key. If this is a file, it can be read using the file interpolation function
    name String
    The name of the SSH key for identification
    publicKey string
    The public key. If this is a file, it can be read using the file interpolation function
    name string
    The name of the SSH key for identification
    public_key str
    The public key. If this is a file, it can be read using the file interpolation function
    name str
    The name of the SSH key for identification
    publicKey String
    The public key. If this is a file, it can be read using the file interpolation function
    name String
    The name of the SSH key for identification

    Outputs

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

    Created string
    The timestamp for when the SSH key was created.
    Fingerprint string
    The fingerprint of the SSH key.
    Id string
    The provider-assigned unique ID for this managed resource.
    OwnerId string
    The UUID of the Equinix Metal API User who owns this key.
    Updated string
    The timestamp for the last time the SSH key was updated.
    Created string
    The timestamp for when the SSH key was created.
    Fingerprint string
    The fingerprint of the SSH key.
    Id string
    The provider-assigned unique ID for this managed resource.
    OwnerId string
    The UUID of the Equinix Metal API User who owns this key.
    Updated string
    The timestamp for the last time the SSH key was updated.
    created String
    The timestamp for when the SSH key was created.
    fingerprint String
    The fingerprint of the SSH key.
    id String
    The provider-assigned unique ID for this managed resource.
    ownerId String
    The UUID of the Equinix Metal API User who owns this key.
    updated String
    The timestamp for the last time the SSH key was updated.
    created string
    The timestamp for when the SSH key was created.
    fingerprint string
    The fingerprint of the SSH key.
    id string
    The provider-assigned unique ID for this managed resource.
    ownerId string
    The UUID of the Equinix Metal API User who owns this key.
    updated string
    The timestamp for the last time the SSH key was updated.
    created str
    The timestamp for when the SSH key was created.
    fingerprint str
    The fingerprint of the SSH key.
    id str
    The provider-assigned unique ID for this managed resource.
    owner_id str
    The UUID of the Equinix Metal API User who owns this key.
    updated str
    The timestamp for the last time the SSH key was updated.
    created String
    The timestamp for when the SSH key was created.
    fingerprint String
    The fingerprint of the SSH key.
    id String
    The provider-assigned unique ID for this managed resource.
    ownerId String
    The UUID of the Equinix Metal API User who owns this key.
    updated String
    The timestamp for the last time the SSH key was updated.

    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,
            created: Optional[str] = None,
            fingerprint: Optional[str] = None,
            name: Optional[str] = None,
            owner_id: Optional[str] = None,
            public_key: Optional[str] = None,
            updated: 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:
    Created string
    The timestamp for when the SSH key was created.
    Fingerprint string
    The fingerprint of the SSH key.
    Name string
    The name of the SSH key for identification
    OwnerId string
    The UUID of the Equinix Metal API User who owns this key.
    PublicKey string
    The public key. If this is a file, it can be read using the file interpolation function
    Updated string
    The timestamp for the last time the SSH key was updated.
    Created string
    The timestamp for when the SSH key was created.
    Fingerprint string
    The fingerprint of the SSH key.
    Name string
    The name of the SSH key for identification
    OwnerId string
    The UUID of the Equinix Metal API User who owns this key.
    PublicKey string
    The public key. If this is a file, it can be read using the file interpolation function
    Updated string
    The timestamp for the last time the SSH key was updated.
    created String
    The timestamp for when the SSH key was created.
    fingerprint String
    The fingerprint of the SSH key.
    name String
    The name of the SSH key for identification
    ownerId String
    The UUID of the Equinix Metal API User who owns this key.
    publicKey String
    The public key. If this is a file, it can be read using the file interpolation function
    updated String
    The timestamp for the last time the SSH key was updated.
    created string
    The timestamp for when the SSH key was created.
    fingerprint string
    The fingerprint of the SSH key.
    name string
    The name of the SSH key for identification
    ownerId string
    The UUID of the Equinix Metal API User who owns this key.
    publicKey string
    The public key. If this is a file, it can be read using the file interpolation function
    updated string
    The timestamp for the last time the SSH key was updated.
    created str
    The timestamp for when the SSH key was created.
    fingerprint str
    The fingerprint of the SSH key.
    name str
    The name of the SSH key for identification
    owner_id str
    The UUID of the Equinix Metal API User who owns this key.
    public_key str
    The public key. If this is a file, it can be read using the file interpolation function
    updated str
    The timestamp for the last time the SSH key was updated.
    created String
    The timestamp for when the SSH key was created.
    fingerprint String
    The fingerprint of the SSH key.
    name String
    The name of the SSH key for identification
    ownerId String
    The UUID of the Equinix Metal API User who owns this key.
    publicKey String
    The public key. If this is a file, it can be read using the file interpolation function
    updated String
    The timestamp for the last time the SSH key was updated.

    Package Details

    Repository
    equinix equinix/pulumi-equinix
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the equinix Terraform Provider.
    equinix logo
    Equinix v0.8.0 published on Tuesday, Apr 2, 2024 by Equinix