This package is deprecated. We recommend using the new Equinix package.
equinix-metal.SshKey
Explore with Pulumi AI
This package is deprecated. We recommend using the new Equinix package.
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.IO;
using Pulumi;
using EquinixMetal = Pulumi.EquinixMetal;
class MyStack : Stack
{
public MyStack()
{
// Create a new SSH key
var key1 = new EquinixMetal.SshKey("key1", new EquinixMetal.SshKeyArgs
{
PublicKey = File.ReadAllText("/home/terraform/.ssh/id_rsa.pub"),
});
// Create new device with "key1" included. The device resource "depends_on" the
// key, in order to make sure the key is created before the device.
var test = new EquinixMetal.Device("test", new EquinixMetal.DeviceArgs
{
Hostname = "test-device",
Plan = "c3.small.x86",
Facilities =
{
"sjc1",
},
OperatingSystem = "ubuntu_20_04",
BillingCycle = "hourly",
ProjectId = local.Project_id,
}, new CustomResourceOptions
{
DependsOn =
{
"metal_ssh_key.key1",
},
});
}
}
package main
import (
"io/ioutil"
"github.com/pulumi/pulumi-equinix-metal/sdk/v3/go/equinix-metal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func readFileOrPanic(path string) pulumi.StringPtrInput {
data, err := ioutil.ReadFile(path)
if err != nil {
panic(err.Error())
}
return pulumi.String(string(data))
}
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := equinix - metal.NewSshKey(ctx, "key1", &equinix-metal.SshKeyArgs{
PublicKey: readFileOrPanic("/home/terraform/.ssh/id_rsa.pub"),
})
if err != nil {
return err
}
_, err = equinix - metal.NewDevice(ctx, "test", &equinix-metal.DeviceArgs{
Hostname: pulumi.String("test-device"),
Plan: pulumi.String("c3.small.x86"),
Facilities: pulumi.StringArray{
pulumi.String("sjc1"),
},
OperatingSystem: pulumi.String("ubuntu_20_04"),
BillingCycle: pulumi.String("hourly"),
ProjectId: pulumi.Any(local.Project_id),
}, pulumi.DependsOn([]pulumi.Resource{
pulumi.Resource("metal_ssh_key.key1"),
}))
if err != nil {
return err
}
return nil
})
}
Coming soon!
import pulumi
import pulumi_equinix_metal as equinix_metal
# Create a new SSH key
key1 = equinix_metal.SshKey("key1", public_key=(lambda path: open(path).read())("/home/terraform/.ssh/id_rsa.pub"))
# Create new device with "key1" included. The device resource "depends_on" the
# key, in order to make sure the key is created before the device.
test = equinix_metal.Device("test",
hostname="test-device",
plan="c3.small.x86",
facilities=["sjc1"],
operating_system="ubuntu_20_04",
billing_cycle="hourly",
project_id=local["project_id"],
opts=pulumi.ResourceOptions(depends_on=["metal_ssh_key.key1"]))
import * as pulumi from "@pulumi/pulumi";
import * as equinix_metal from "@pulumi/equinix-metal";
import * from "fs";
// Create a new SSH key
const key1 = new equinix_metal.SshKey("key1", {publicKey: fs.readFileSync("/home/terraform/.ssh/id_rsa.pub")});
// Create new device with "key1" included. The device resource "depends_on" the
// key, in order to make sure the key is created before the device.
const test = new equinix_metal.Device("test", {
hostname: "test-device",
plan: "c3.small.x86",
facilities: ["sjc1"],
operatingSystem: "ubuntu_20_04",
billingCycle: "hourly",
projectId: local.project_id,
}, {
dependsOn: ["metal_ssh_key.key1"],
});
Coming soon!
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.
Constructor example
The following reference example uses placeholder values for all input properties.
var sshKeyResource = new EquinixMetal.SshKey("sshKeyResource", new()
{
PublicKey = "string",
Name = "string",
});
example, err := equinixmetal.NewSshKey(ctx, "sshKeyResource", &equinixmetal.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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The SshKey resource accepts the following input properties:
- 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
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.
- Owner
Id 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.
- Owner
Id 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.
- owner
Id 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.
- owner
Id 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.
- owner
Id 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.
- 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
- Owner
Id string - The UUID of the Equinix Metal API User who owns this key
- Public
Key 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
- Owner
Id string - The UUID of the Equinix Metal API User who owns this key
- Public
Key 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
- owner
Id String - The UUID of the Equinix Metal API User who owns this key
- public
Key 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
- owner
Id string - The UUID of the Equinix Metal API User who owns this key
- public
Key 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
- owner
Id String - The UUID of the Equinix Metal API User who owns this key
- public
Key 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
Import
This resource can be imported using an existing SSH Key ID
$ pulumi import equinix-metal:index/sshKey:SshKey metal_ssh_key {existing_sshkey_id}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Equinix Metal pulumi/pulumi-equinix-metal
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
metal
Terraform Provider.
This package is deprecated. We recommend using the new Equinix package.