1. Packages
  2. Vultr
  3. API Docs
  4. getSshKey
Vultr v2.23.1 published on Tuesday, Dec 10, 2024 by dirien

vultr.getSshKey

Explore with Pulumi AI

Vultr v2.23.1 published on Tuesday, Dec 10, 2024 by dirien

Get information about a Vultr SSH key. This data source provides the name, public SSH key, and the creation date for your Vultr SSH key.

Example Usage

Get the information for an SSH key by name:

import * as pulumi from "@pulumi/pulumi";
import * as vultr from "@pulumi/vultr";

const mySshKey = vultr.getSshKey({
    filters: [{
        name: "name",
        values: ["my-ssh-key-name"],
    }],
});
Copy
import pulumi
import pulumi_vultr as vultr

my_ssh_key = vultr.get_ssh_key(filters=[{
    "name": "name",
    "values": ["my-ssh-key-name"],
}])
Copy
package main

import (
	"github.com/dirien/pulumi-vultr/sdk/v2/go/vultr"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := vultr.GetSshKey(ctx, &vultr.GetSshKeyArgs{
			Filters: []vultr.GetSshKeyFilter{
				{
					Name: "name",
					Values: []string{
						"my-ssh-key-name",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vultr = Pulumi.Vultr;

return await Deployment.RunAsync(() => 
{
    var mySshKey = Vultr.GetSshKey.Invoke(new()
    {
        Filters = new[]
        {
            new Vultr.Inputs.GetSshKeyFilterInputArgs
            {
                Name = "name",
                Values = new[]
                {
                    "my-ssh-key-name",
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vultr.VultrFunctions;
import com.pulumi.vultr.inputs.GetSshKeyArgs;
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) {
        final var mySshKey = VultrFunctions.getSshKey(GetSshKeyArgs.builder()
            .filters(GetSshKeyFilterArgs.builder()
                .name("name")
                .values("my-ssh-key-name")
                .build())
            .build());

    }
}
Copy
variables:
  mySshKey:
    fn::invoke:
      Function: vultr:getSshKey
      Arguments:
        filters:
          - name: name
            values:
              - my-ssh-key-name
Copy

Using getSshKey

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getSshKey(args: GetSshKeyArgs, opts?: InvokeOptions): Promise<GetSshKeyResult>
function getSshKeyOutput(args: GetSshKeyOutputArgs, opts?: InvokeOptions): Output<GetSshKeyResult>
Copy
def get_ssh_key(filters: Optional[Sequence[GetSshKeyFilter]] = None,
                opts: Optional[InvokeOptions] = None) -> GetSshKeyResult
def get_ssh_key_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetSshKeyFilterArgs]]]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetSshKeyResult]
Copy
func GetSshKey(ctx *Context, args *GetSshKeyArgs, opts ...InvokeOption) (*GetSshKeyResult, error)
func GetSshKeyOutput(ctx *Context, args *GetSshKeyOutputArgs, opts ...InvokeOption) GetSshKeyResultOutput
Copy

> Note: This function is named GetSshKey in the Go SDK.

public static class GetSshKey 
{
    public static Task<GetSshKeyResult> InvokeAsync(GetSshKeyArgs args, InvokeOptions? opts = null)
    public static Output<GetSshKeyResult> Invoke(GetSshKeyInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetSshKeyResult> getSshKey(GetSshKeyArgs args, InvokeOptions options)
public static Output<GetSshKeyResult> getSshKey(GetSshKeyArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: vultr:index/getSshKey:getSshKey
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Filters Changes to this property will trigger replacement. List<ediri.Vultr.Inputs.GetSshKeyFilter>
Query parameters for finding SSH keys.
Filters Changes to this property will trigger replacement. []GetSshKeyFilter
Query parameters for finding SSH keys.
filters Changes to this property will trigger replacement. List<GetSshKeyFilter>
Query parameters for finding SSH keys.
filters Changes to this property will trigger replacement. GetSshKeyFilter[]
Query parameters for finding SSH keys.
filters Changes to this property will trigger replacement. Sequence[GetSshKeyFilter]
Query parameters for finding SSH keys.
filters Changes to this property will trigger replacement. List<Property Map>
Query parameters for finding SSH keys.

getSshKey Result

The following output properties are available:

DateCreated string
The date the SSH key was added to your Vultr account.
Id string
The ID of the SSH key.
Name string
The name of the SSH key.
SshKey string
The public SSH key.
Filters List<ediri.Vultr.Outputs.GetSshKeyFilter>
DateCreated string
The date the SSH key was added to your Vultr account.
Id string
The ID of the SSH key.
Name string
The name of the SSH key.
SshKey string
The public SSH key.
Filters []GetSshKeyFilter
dateCreated String
The date the SSH key was added to your Vultr account.
id String
The ID of the SSH key.
name String
The name of the SSH key.
sshKey String
The public SSH key.
filters List<GetSshKeyFilter>
dateCreated string
The date the SSH key was added to your Vultr account.
id string
The ID of the SSH key.
name string
The name of the SSH key.
sshKey string
The public SSH key.
filters GetSshKeyFilter[]
date_created str
The date the SSH key was added to your Vultr account.
id str
The ID of the SSH key.
name str
The name of the SSH key.
ssh_key str
The public SSH key.
filters Sequence[GetSshKeyFilter]
dateCreated String
The date the SSH key was added to your Vultr account.
id String
The ID of the SSH key.
name String
The name of the SSH key.
sshKey String
The public SSH key.
filters List<Property Map>

Supporting Types

GetSshKeyFilter

Name This property is required. string
Attribute name to filter with.
Values This property is required. List<string>
One or more values filter with.
Name This property is required. string
Attribute name to filter with.
Values This property is required. []string
One or more values filter with.
name This property is required. String
Attribute name to filter with.
values This property is required. List<String>
One or more values filter with.
name This property is required. string
Attribute name to filter with.
values This property is required. string[]
One or more values filter with.
name This property is required. str
Attribute name to filter with.
values This property is required. Sequence[str]
One or more values filter with.
name This property is required. String
Attribute name to filter with.
values This property is required. List<String>
One or more values filter with.

Package Details

Repository
vultr dirien/pulumi-vultr
License
Apache-2.0
Notes
This Pulumi package is based on the vultr Terraform Provider.
Vultr v2.23.1 published on Tuesday, Dec 10, 2024 by dirien