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

equinix.metal.ProjectSshKey

Explore with Pulumi AI

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

    Provides an Equinix Metal project SSH key resource to manage project-specific SSH keys. Project SSH keys will only be populated onto servers that belong to that project, in contrast to User SSH Keys.

    Example Usage

    using System.Collections.Generic;
    using System.IO;
    using Pulumi;
    using Equinix = Pulumi.Equinix;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var projectId = config.Require("projectId");
        var sshKey = new Equinix.Metal.ProjectSshKey("sshKey", new()
        {
            ProjectId = projectId,
            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"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    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 {
    		cfg := config.New(ctx, "")
    		projectId := cfg.Require("projectId")
    		sshKey, err := metal.NewProjectSshKey(ctx, "sshKey", &metal.ProjectSshKeyArgs{
    			ProjectId: pulumi.String(projectId),
    			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.ProjectSshKey;
    import com.equinix.pulumi.metal.ProjectSshKeyArgs;
    
    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) {
            final var config = ctx.config();
            final var projectId = config.get("projectId").get();
    
            String content = null;
            try {
                content = Files.readString(Paths.get("/Users/John/.ssh/metal_rsa.pub"));
            } catch (IOException e) {
                e.printStackTrace();
            }
    
            var sshKey = new ProjectSshKey("sshKey", ProjectSshKeyArgs.builder()        
                .projectId(projectId)
                .name("johnKent")
                .publicKey(content)
                .build());
    
            ctx.export("sshKeyId", sshKey.id());
        }
    }
    
    import pulumi
    import pulumi_equinix as equinix
    
    config = pulumi.Config()
    project_id = config.require("projectId")
    ssh_key = equinix.metal.ProjectSshKey("sshKey",
        project_id=project_id,
        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 config = new pulumi.Config();
    const projectId = config.require("projectId");
    const sshKey = new equinix.metal.ProjectSshKey("sshKey", {
        projectId: projectId,
        name: "johnKent",
        publicKey: fs.readFileSync("/Users/John/.ssh/metal_rsa.pub"),
    });
    export const sshKeyId = sshKey.id;
    
    config:
      projectId:
        type: string
    resources:
      sshKey:
        type: equinix:metal:ProjectSshKey
        properties:
          projectId: ${projectId}
          name: johnKent
          publicKey:
            fn::readFile: /Users/John/.ssh/metal_rsa.pub
    outputs:
      sshKeyId: ${sshKey.id}
    

    Create ProjectSshKey Resource

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

    Constructor syntax

    new ProjectSshKey(name: string, args: ProjectSshKeyArgs, opts?: CustomResourceOptions);
    @overload
    def ProjectSshKey(resource_name: str,
                      args: ProjectSshKeyArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def ProjectSshKey(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      project_id: Optional[str] = None,
                      public_key: Optional[str] = None,
                      name: Optional[str] = None)
    func NewProjectSshKey(ctx *Context, name string, args ProjectSshKeyArgs, opts ...ResourceOption) (*ProjectSshKey, error)
    public ProjectSshKey(string name, ProjectSshKeyArgs args, CustomResourceOptions? opts = null)
    public ProjectSshKey(String name, ProjectSshKeyArgs args)
    public ProjectSshKey(String name, ProjectSshKeyArgs args, CustomResourceOptions options)
    
    type: equinix:metal:ProjectSshKey
    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 ProjectSshKeyArgs
    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 ProjectSshKeyArgs
    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 ProjectSshKeyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ProjectSshKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ProjectSshKeyArgs
    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 projectSshKeyResource = new Equinix.Metal.ProjectSshKey("projectSshKeyResource", new()
    {
        ProjectId = "string",
        PublicKey = "string",
        Name = "string",
    });
    
    example, err := metal.NewProjectSshKey(ctx, "projectSshKeyResource", &metal.ProjectSshKeyArgs{
    	ProjectId: pulumi.String("string"),
    	PublicKey: pulumi.String("string"),
    	Name:      pulumi.String("string"),
    })
    
    var projectSshKeyResource = new ProjectSshKey("projectSshKeyResource", ProjectSshKeyArgs.builder()        
        .projectId("string")
        .publicKey("string")
        .name("string")
        .build());
    
    project_ssh_key_resource = equinix.metal.ProjectSshKey("projectSshKeyResource",
        project_id="string",
        public_key="string",
        name="string")
    
    const projectSshKeyResource = new equinix.metal.ProjectSshKey("projectSshKeyResource", {
        projectId: "string",
        publicKey: "string",
        name: "string",
    });
    
    type: equinix:metal:ProjectSshKey
    properties:
        name: string
        projectId: string
        publicKey: string
    

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

    ProjectId string
    The ID of parent project.
    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.
    ProjectId string
    The ID of parent project.
    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.
    projectId String
    The ID of parent project.
    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.
    projectId string
    The ID of parent project.
    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.
    project_id str
    The ID of parent project.
    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.
    projectId String
    The ID of parent project.
    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 ProjectSshKey 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 ID of parent project (same as project_id).
    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 ID of parent project (same as project_id).
    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 ID of parent project (same as project_id).
    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 ID of parent project (same as project_id).
    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 ID of parent project (same as project_id).
    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 ID of parent project (same as project_id).
    updated String
    The timestamp for the last time the SSH key was updated.

    Look up Existing ProjectSshKey Resource

    Get an existing ProjectSshKey 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?: ProjectSshKeyState, opts?: CustomResourceOptions): ProjectSshKey
    @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,
            project_id: Optional[str] = None,
            public_key: Optional[str] = None,
            updated: Optional[str] = None) -> ProjectSshKey
    func GetProjectSshKey(ctx *Context, name string, id IDInput, state *ProjectSshKeyState, opts ...ResourceOption) (*ProjectSshKey, error)
    public static ProjectSshKey Get(string name, Input<string> id, ProjectSshKeyState? state, CustomResourceOptions? opts = null)
    public static ProjectSshKey get(String name, Output<String> id, ProjectSshKeyState 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 ID of parent project (same as project_id).
    ProjectId string
    The ID of parent project.
    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 ID of parent project (same as project_id).
    ProjectId string
    The ID of parent project.
    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 ID of parent project (same as project_id).
    projectId String
    The ID of parent project.
    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 ID of parent project (same as project_id).
    projectId string
    The ID of parent project.
    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 ID of parent project (same as project_id).
    project_id str
    The ID of parent project.
    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 ID of parent project (same as project_id).
    projectId String
    The ID of parent project.
    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