# danubedata.SshKey
Manages an SSH key for VPS authentication.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as danubedata from "@danubedata/pulumi";
import * as fs from "fs";
const main = new danubedata.SshKey("main", {publicKey: fs.readFileSync("~/.ssh/id_ed25519.pub", "utf8")});
import pulumi
import pulumi_danubedata as danubedata
main = danubedata.SshKey("main", public_key=(lambda path: open(path).read())("~/.ssh/id_ed25519.pub"))
package main
import (
"os"
"github.com/AdrianSilaghi/pulumi-danubedata/sdk/go/danubedata"
"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 := danubedata.NewSshKey(ctx, "main", &danubedata.SshKeyArgs{
PublicKey: pulumi.String(readFileOrPanic("~/.ssh/id_ed25519.pub")),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Pulumi;
using DanubeData = DanubeData.DanubeData;
return await Deployment.RunAsync(() =>
{
var main = new DanubeData.SshKey("main", new()
{
PublicKey = File.ReadAllText("~/.ssh/id_ed25519.pub"),
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.danubedata.SshKey;
import com.pulumi.danubedata.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 main = new SshKey("main", SshKeyArgs.builder()
.publicKey(Files.readString(Paths.get("~/.ssh/id_ed25519.pub")))
.build());
}
}
resources:
main:
type: danubedata:SshKey
properties:
publicKey:
fn::readFile: ~/.ssh/id_ed25519.pub
Using with VPS
import * as pulumi from "@pulumi/pulumi";
import * as danubedata from "@danubedata/pulumi";
const deploy = new danubedata.SshKey("deploy", {publicKey: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... deploy@example.com"});
const server = new danubedata.Vps("server", {
image: "ubuntu-22.04",
datacenter: "fsn1",
authMethod: "ssh_key",
sshKeyId: deploy.id,
});
import pulumi
import pulumi_danubedata as danubedata
deploy = danubedata.SshKey("deploy", public_key="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... deploy@example.com")
server = danubedata.Vps("server",
image="ubuntu-22.04",
datacenter="fsn1",
auth_method="ssh_key",
ssh_key_id=deploy.id)
package main
import (
"github.com/AdrianSilaghi/pulumi-danubedata/sdk/go/danubedata"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
deploy, err := danubedata.NewSshKey(ctx, "deploy", &danubedata.SshKeyArgs{
PublicKey: pulumi.String("ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... deploy@example.com"),
})
if err != nil {
return err
}
_, err = danubedata.NewVps(ctx, "server", &danubedata.VpsArgs{
Image: pulumi.String("ubuntu-22.04"),
Datacenter: pulumi.String("fsn1"),
AuthMethod: pulumi.String("ssh_key"),
SshKeyId: deploy.ID(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DanubeData = DanubeData.DanubeData;
return await Deployment.RunAsync(() =>
{
var deploy = new DanubeData.SshKey("deploy", new()
{
PublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... deploy@example.com",
});
var server = new DanubeData.Vps("server", new()
{
Image = "ubuntu-22.04",
Datacenter = "fsn1",
AuthMethod = "ssh_key",
SshKeyId = deploy.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.danubedata.SshKey;
import com.pulumi.danubedata.SshKeyArgs;
import com.pulumi.danubedata.Vps;
import com.pulumi.danubedata.VpsArgs;
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 deploy = new SshKey("deploy", SshKeyArgs.builder()
.publicKey("ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... deploy@example.com")
.build());
var server = new Vps("server", VpsArgs.builder()
.image("ubuntu-22.04")
.datacenter("fsn1")
.authMethod("ssh_key")
.sshKeyId(deploy.id())
.build());
}
}
resources:
deploy:
type: danubedata:SshKey
properties:
publicKey: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... deploy@example.com
server:
type: danubedata:Vps
properties:
image: ubuntu-22.04
datacenter: fsn1
authMethod: ssh_key
sshKeyId: ${deploy.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: danubedata: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 DanubeData.SshKey("sshKeyResource", new()
{
PublicKey = "string",
Name = "string",
});
example, err := danubedata.NewSshKey(ctx, "sshKeyResource", &danubedata.SshKeyArgs{
PublicKey: pulumi.String("string"),
Name: pulumi.String("string"),
})
var sshKeyResource = new SshKey("sshKeyResource", SshKeyArgs.builder()
.publicKey("string")
.name("string")
.build());
ssh_key_resource = danubedata.SshKey("sshKeyResource",
public_key="string",
name="string")
const sshKeyResource = new danubedata.SshKey("sshKeyResource", {
publicKey: "string",
name: "string",
});
type: danubedata: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 SSH public key in OpenSSH format (e.g., 'ssh-rsa AAAA...' or 'ssh-ed25519 AAAA...').
- name str
- A descriptive name for the SSH key.
Outputs
All input properties are implicitly available as output properties. Additionally, the SshKey resource produces the following output properties:
- Created
At string - Creation timestamp.
- Fingerprint string
- The SSH key fingerprint.
- Id string
- The provider-assigned unique ID for this managed resource.
- Updated
At string - Timestamp when the SSH key was last updated.
- Created
At string - Creation timestamp.
- Fingerprint string
- The SSH key fingerprint.
- Id string
- The provider-assigned unique ID for this managed resource.
- Updated
At string - Timestamp when the SSH key was last updated.
- created
At String - Creation timestamp.
- fingerprint String
- The SSH key fingerprint.
- id String
- The provider-assigned unique ID for this managed resource.
- updated
At String - Timestamp when the SSH key was last updated.
- created
At string - Creation timestamp.
- fingerprint string
- The SSH key fingerprint.
- id string
- The provider-assigned unique ID for this managed resource.
- updated
At string - Timestamp when the SSH key was last updated.
- created_
at str - Creation timestamp.
- fingerprint str
- The SSH key fingerprint.
- id str
- The provider-assigned unique ID for this managed resource.
- updated_
at str - Timestamp when the SSH key was last updated.
- created
At String - Creation timestamp.
- fingerprint String
- The SSH key fingerprint.
- id String
- The provider-assigned unique ID for this managed resource.
- updated
At String - Timestamp when the SSH key was last 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_at: Optional[str] = None,
fingerprint: Optional[str] = None,
name: Optional[str] = None,
public_key: Optional[str] = None,
updated_at: Optional[str] = None) -> SshKeyfunc 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)resources: _: type: danubedata:SshKey get: id: ${id}- 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
At string - Creation timestamp.
- Fingerprint string
- The SSH key fingerprint.
- Name string
- A descriptive name for the SSH key.
- Public
Key string - The SSH public key in OpenSSH format (e.g., 'ssh-rsa AAAA...' or 'ssh-ed25519 AAAA...').
- Updated
At string - Timestamp when the SSH key was last updated.
- Created
At string - Creation timestamp.
- Fingerprint string
- The SSH key fingerprint.
- Name string
- A descriptive name for the SSH key.
- Public
Key string - The SSH public key in OpenSSH format (e.g., 'ssh-rsa AAAA...' or 'ssh-ed25519 AAAA...').
- Updated
At string - Timestamp when the SSH key was last updated.
- created
At String - Creation timestamp.
- fingerprint String
- The SSH key fingerprint.
- name String
- A descriptive name for the SSH key.
- public
Key String - The SSH public key in OpenSSH format (e.g., 'ssh-rsa AAAA...' or 'ssh-ed25519 AAAA...').
- updated
At String - Timestamp when the SSH key was last updated.
- created
At string - Creation timestamp.
- fingerprint string
- The SSH key fingerprint.
- name string
- A descriptive name for the SSH key.
- public
Key string - The SSH public key in OpenSSH format (e.g., 'ssh-rsa AAAA...' or 'ssh-ed25519 AAAA...').
- updated
At string - Timestamp when the SSH key was last updated.
- created_
at str - Creation timestamp.
- fingerprint str
- The SSH key fingerprint.
- name str
- A descriptive name for the SSH key.
- public_
key str - The SSH public key in OpenSSH format (e.g., 'ssh-rsa AAAA...' or 'ssh-ed25519 AAAA...').
- updated_
at str - Timestamp when the SSH key was last updated.
- created
At String - Creation timestamp.
- fingerprint String
- The SSH key fingerprint.
- name String
- A descriptive name for the SSH key.
- public
Key String - The SSH public key in OpenSSH format (e.g., 'ssh-rsa AAAA...' or 'ssh-ed25519 AAAA...').
- updated
At String - Timestamp when the SSH key was last updated.
Import
SSH keys can be imported using their ID:
bash
$ pulumi import danubedata:index/sshKey:SshKey example key-abc123
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- danubedata AdrianSilaghi/pulumi-danubedata
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
danubedataTerraform Provider.
