equinix.networkedge.SshKey
Explore with Pulumi AI
Resource equinix.networkedge.SshKey
allows creation and management of Equinix Network Edge SSH keys.
Example Usage
using System.Collections.Generic;
using System.IO;
using Pulumi;
using Equinix = Pulumi.Equinix;
return await Deployment.RunAsync(() =>
{
var sshKey = new Equinix.NetworkEdge.SshKey("sshKey", new()
{
Name = "johnKent",
PublicKey = File.ReadAllText("/Users/John/.ssh/ne_rsa.pub"),
});
return new Dictionary<string, object?>
{
["sshKeyId"] = sshKey.Id,
};
});
package main
import (
"os"
"github.com/equinix/pulumi-equinix/sdk/go/equinix/networkedge"
"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 := networkedge.NewSshKey(ctx, "sshKey", &networkedge.SshKeyArgs{
Name: pulumi.String("johnKent"),
PublicKey: readFileOrPanic("/Users/John/.ssh/ne_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.pulumi.core.Output;
import com.equinix.pulumi.networkedge.SshKey;
import com.equinix.pulumi.networkedge.SshKeyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.IOException;
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) {
String key = null;
try {
key = Files.readString(Paths.get("/Users/John/.ssh/ne_rsa.pub"));
} catch (IOException e) {
e.printStackTrace();
}
var sshKey = new SshKey("sshKey", SshKeyArgs.builder()
.name("johnKent")
.publicKey(key)
.build());
ctx.export("sshKeyId", sshKey.id());
}
}
import pulumi
import pulumi_equinix as equinix
ssh_key = equinix.networkedge.SshKey("sshKey",
name="johnKent",
public_key=(lambda path: open(path).read())("/Users/John/.ssh/ne_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.networkedge.SshKey("sshKey", {
name: "johnKent",
publicKey: fs.readFileSync("/Users/John/.ssh/ne_rsa.pub"),
});
export const sshKeyId = sshKey.id;
resources:
sshKey:
type: equinix:networkedge:SshKey
properties:
name: johnKent
publicKey:
fn::readFile: /Users/John/.ssh/ne_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,
project_id: Optional[str] = None,
type: 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:networkedge: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 equinixSshKeyResource = new Equinix.NetworkEdge.SshKey("equinixSshKeyResource", new()
{
PublicKey = "string",
Name = "string",
ProjectId = "string",
Type = "string",
});
example, err := networkedge.NewSshKey(ctx, "equinixSshKeyResource", &networkedge.SshKeyArgs{
PublicKey: pulumi.String("string"),
Name: pulumi.String("string"),
ProjectId: pulumi.String("string"),
Type: pulumi.String("string"),
})
var equinixSshKeyResource = new SshKey("equinixSshKeyResource", SshKeyArgs.builder()
.publicKey("string")
.name("string")
.projectId("string")
.type("string")
.build());
equinix_ssh_key_resource = equinix.networkedge.SshKey("equinixSshKeyResource",
public_key="string",
name="string",
project_id="string",
type="string")
const equinixSshKeyResource = new equinix.networkedge.SshKey("equinixSshKeyResource", {
publicKey: "string",
name: "string",
projectId: "string",
type: "string",
});
type: equinix:networkedge:SshKey
properties:
name: string
projectId: string
publicKey: string
type: 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:
- Public
Key string - The SSH public key. If this is a file, it can be read using the file interpolation function.
- Name string
- The name of SSH key used for identification.
- Project
Id string - Unique Identifier for the project resource where the SSH key is scoped to.If you leave it out, the ssh key will be created under the default project id of your organization.
- Type string
- The type of SSH key:
RSA
(default) orDSA
.
- Public
Key string - The SSH public key. If this is a file, it can be read using the file interpolation function.
- Name string
- The name of SSH key used for identification.
- Project
Id string - Unique Identifier for the project resource where the SSH key is scoped to.If you leave it out, the ssh key will be created under the default project id of your organization.
- Type string
- The type of SSH key:
RSA
(default) orDSA
.
- public
Key String - The SSH public key. If this is a file, it can be read using the file interpolation function.
- name String
- The name of SSH key used for identification.
- project
Id String - Unique Identifier for the project resource where the SSH key is scoped to.If you leave it out, the ssh key will be created under the default project id of your organization.
- type String
- The type of SSH key:
RSA
(default) orDSA
.
- public
Key string - The SSH public key. If this is a file, it can be read using the file interpolation function.
- name string
- The name of SSH key used for identification.
- project
Id string - Unique Identifier for the project resource where the SSH key is scoped to.If you leave it out, the ssh key will be created under the default project id of your organization.
- type string
- The type of SSH key:
RSA
(default) orDSA
.
- public_
key str - The SSH public key. If this is a file, it can be read using the file interpolation function.
- name str
- The name of SSH key used for identification.
- project_
id str - Unique Identifier for the project resource where the SSH key is scoped to.If you leave it out, the ssh key will be created under the default project id of your organization.
- type str
- The type of SSH key:
RSA
(default) orDSA
.
- public
Key String - The SSH public key. If this is a file, it can be read using the file interpolation function.
- name String
- The name of SSH key used for identification.
- project
Id String - Unique Identifier for the project resource where the SSH key is scoped to.If you leave it out, the ssh key will be created under the default project id of your organization.
- type String
- The type of SSH key:
RSA
(default) orDSA
.
Outputs
All input properties are implicitly available as output properties. Additionally, the SshKey resource produces the following output properties:
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,
name: Optional[str] = None,
project_id: Optional[str] = None,
public_key: Optional[str] = None,
type: Optional[str] = None,
uuid: 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.
- Name string
- The name of SSH key used for identification.
- Project
Id string - Unique Identifier for the project resource where the SSH key is scoped to.If you leave it out, the ssh key will be created under the default project id of your organization.
- Public
Key string - The SSH public key. If this is a file, it can be read using the file interpolation function.
- Type string
- The type of SSH key:
RSA
(default) orDSA
. - Uuid string
- The unique identifier of the key
- Name string
- The name of SSH key used for identification.
- Project
Id string - Unique Identifier for the project resource where the SSH key is scoped to.If you leave it out, the ssh key will be created under the default project id of your organization.
- Public
Key string - The SSH public key. If this is a file, it can be read using the file interpolation function.
- Type string
- The type of SSH key:
RSA
(default) orDSA
. - Uuid string
- The unique identifier of the key
- name String
- The name of SSH key used for identification.
- project
Id String - Unique Identifier for the project resource where the SSH key is scoped to.If you leave it out, the ssh key will be created under the default project id of your organization.
- public
Key String - The SSH public key. If this is a file, it can be read using the file interpolation function.
- type String
- The type of SSH key:
RSA
(default) orDSA
. - uuid String
- The unique identifier of the key
- name string
- The name of SSH key used for identification.
- project
Id string - Unique Identifier for the project resource where the SSH key is scoped to.If you leave it out, the ssh key will be created under the default project id of your organization.
- public
Key string - The SSH public key. If this is a file, it can be read using the file interpolation function.
- type string
- The type of SSH key:
RSA
(default) orDSA
. - uuid string
- The unique identifier of the key
- name str
- The name of SSH key used for identification.
- project_
id str - Unique Identifier for the project resource where the SSH key is scoped to.If you leave it out, the ssh key will be created under the default project id of your organization.
- public_
key str - The SSH public key. If this is a file, it can be read using the file interpolation function.
- type str
- The type of SSH key:
RSA
(default) orDSA
. - uuid str
- The unique identifier of the key
- name String
- The name of SSH key used for identification.
- project
Id String - Unique Identifier for the project resource where the SSH key is scoped to.If you leave it out, the ssh key will be created under the default project id of your organization.
- public
Key String - The SSH public key. If this is a file, it can be read using the file interpolation function.
- type String
- The type of SSH key:
RSA
(default) orDSA
. - uuid String
- The unique identifier of the key
Package Details
- Repository
- equinix equinix/pulumi-equinix
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
equinix
Terraform Provider.