1. Packages
  2. Linode Provider
  3. API Docs
  4. getSshkeys
Linode v4.36.0 published on Thursday, Mar 27, 2025 by Pulumi

linode.getSshkeys

Explore with Pulumi AI

linode.SshKey provides access to a filtered list of SSH Keys in the Profile of the User identified by the access token. For more information, see the Linode APIv4 docs.

Example Usage

The following example shows how the resource might be used to obtain the names of the SSH Keys configured on the Linode user profile.

The following example shows how one might use this data source to access information about a Linode Kernel.

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

const filteredSsh = linode.getSshkeys({
    filters: [
        {
            name: "label",
            values: ["my-ssh"],
        },
        {
            name: "ssh_key",
            values: ["RSA-6522525"],
        },
    ],
});
Copy
import pulumi
import pulumi_linode as linode

filtered_ssh = linode.get_sshkeys(filters=[
    {
        "name": "label",
        "values": ["my-ssh"],
    },
    {
        "name": "ssh_key",
        "values": ["RSA-6522525"],
    },
])
Copy
package main

import (
	"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := linode.GetSshkeys(ctx, &linode.GetSshkeysArgs{
			Filters: []linode.GetSshkeysFilter{
				{
					Name: "label",
					Values: []string{
						"my-ssh",
					},
				},
				{
					Name: "ssh_key",
					Values: []string{
						"RSA-6522525",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Linode = Pulumi.Linode;

return await Deployment.RunAsync(() => 
{
    var filteredSsh = Linode.GetSshkeys.Invoke(new()
    {
        Filters = new[]
        {
            new Linode.Inputs.GetSshkeysFilterInputArgs
            {
                Name = "label",
                Values = new[]
                {
                    "my-ssh",
                },
            },
            new Linode.Inputs.GetSshkeysFilterInputArgs
            {
                Name = "ssh_key",
                Values = new[]
                {
                    "RSA-6522525",
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.linode.LinodeFunctions;
import com.pulumi.linode.inputs.GetSshkeysArgs;
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 filteredSsh = LinodeFunctions.getSshkeys(GetSshkeysArgs.builder()
            .filters(            
                GetSshkeysFilterArgs.builder()
                    .name("label")
                    .values("my-ssh")
                    .build(),
                GetSshkeysFilterArgs.builder()
                    .name("ssh_key")
                    .values("RSA-6522525")
                    .build())
            .build());

    }
}
Copy
variables:
  filteredSsh:
    fn::invoke:
      function: linode:getSshkeys
      arguments:
        filters:
          - name: label
            values:
              - my-ssh
          - name: ssh_key
            values:
              - RSA-6522525
Copy

Filterable Fields

  • id

  • label

  • ssh_key

Using getSshkeys

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 getSshkeys(args: GetSshkeysArgs, opts?: InvokeOptions): Promise<GetSshkeysResult>
function getSshkeysOutput(args: GetSshkeysOutputArgs, opts?: InvokeOptions): Output<GetSshkeysResult>
Copy
def get_sshkeys(filters: Optional[Sequence[GetSshkeysFilter]] = None,
                order: Optional[str] = None,
                order_by: Optional[str] = None,
                sshkeys: Optional[Sequence[GetSshkeysSshkey]] = None,
                opts: Optional[InvokeOptions] = None) -> GetSshkeysResult
def get_sshkeys_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetSshkeysFilterArgs]]]] = None,
                order: Optional[pulumi.Input[str]] = None,
                order_by: Optional[pulumi.Input[str]] = None,
                sshkeys: Optional[pulumi.Input[Sequence[pulumi.Input[GetSshkeysSshkeyArgs]]]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetSshkeysResult]
Copy
func GetSshkeys(ctx *Context, args *GetSshkeysArgs, opts ...InvokeOption) (*GetSshkeysResult, error)
func GetSshkeysOutput(ctx *Context, args *GetSshkeysOutputArgs, opts ...InvokeOption) GetSshkeysResultOutput
Copy

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

public static class GetSshkeys 
{
    public static Task<GetSshkeysResult> InvokeAsync(GetSshkeysArgs args, InvokeOptions? opts = null)
    public static Output<GetSshkeysResult> Invoke(GetSshkeysInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetSshkeysResult> getSshkeys(GetSshkeysArgs args, InvokeOptions options)
public static Output<GetSshkeysResult> getSshkeys(GetSshkeysArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: linode:index/getSshkeys:getSshkeys
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Filters List<GetSshkeysFilter>
Order string
The order in which results should be returned. (asc, desc; default asc)
OrderBy string
The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
Sshkeys List<GetSshkeysSshkey>
Filters []GetSshkeysFilter
Order string
The order in which results should be returned. (asc, desc; default asc)
OrderBy string
The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
Sshkeys []GetSshkeysSshkey
filters List<GetSshkeysFilter>
order String
The order in which results should be returned. (asc, desc; default asc)
orderBy String
The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
sshkeys List<GetSshkeysSshkey>
filters GetSshkeysFilter[]
order string
The order in which results should be returned. (asc, desc; default asc)
orderBy string
The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
sshkeys GetSshkeysSshkey[]
filters Sequence[GetSshkeysFilter]
order str
The order in which results should be returned. (asc, desc; default asc)
order_by str
The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
sshkeys Sequence[GetSshkeysSshkey]
filters List<Property Map>
order String
The order in which results should be returned. (asc, desc; default asc)
orderBy String
The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
sshkeys List<Property Map>

getSshkeys Result

The following output properties are available:

Id string
The ID of the SSH Key.
Filters []GetSshkeysFilter
Order string
OrderBy string
Sshkeys []GetSshkeysSshkey
id string
The ID of the SSH Key.
filters GetSshkeysFilter[]
order string
orderBy string
sshkeys GetSshkeysSshkey[]
id String
The ID of the SSH Key.
filters List<Property Map>
order String
orderBy String
sshkeys List<Property Map>

Supporting Types

GetSshkeysFilter

Name This property is required. string
The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
Values This property is required. List<string>
A list of values for the filter to allow. These values should all be in string form.
MatchBy string
The method to match the field by. (exact, regex, substring; default exact)
Name This property is required. string
The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
Values This property is required. []string
A list of values for the filter to allow. These values should all be in string form.
MatchBy string
The method to match the field by. (exact, regex, substring; default exact)
name This property is required. String
The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
values This property is required. List<String>
A list of values for the filter to allow. These values should all be in string form.
matchBy String
The method to match the field by. (exact, regex, substring; default exact)
name This property is required. string
The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
values This property is required. string[]
A list of values for the filter to allow. These values should all be in string form.
matchBy string
The method to match the field by. (exact, regex, substring; default exact)
name This property is required. str
The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
values This property is required. Sequence[str]
A list of values for the filter to allow. These values should all be in string form.
match_by str
The method to match the field by. (exact, regex, substring; default exact)
name This property is required. String
The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.
values This property is required. List<String>
A list of values for the filter to allow. These values should all be in string form.
matchBy String
The method to match the field by. (exact, regex, substring; default exact)

GetSshkeysSshkey

Created This property is required. string
The date this key was added.
Label This property is required. string
The label of the SSH Key.
SshKey This property is required. string
The public SSH Key, which is used to authenticate to the root user of the Linodes you deploy.
Id string
The ID of the SSH Key.
Created This property is required. string
The date this key was added.
Label This property is required. string
The label of the SSH Key.
SshKey This property is required. string
The public SSH Key, which is used to authenticate to the root user of the Linodes you deploy.
Id string
The ID of the SSH Key.
created This property is required. String
The date this key was added.
label This property is required. String
The label of the SSH Key.
sshKey This property is required. String
The public SSH Key, which is used to authenticate to the root user of the Linodes you deploy.
id String
The ID of the SSH Key.
created This property is required. string
The date this key was added.
label This property is required. string
The label of the SSH Key.
sshKey This property is required. string
The public SSH Key, which is used to authenticate to the root user of the Linodes you deploy.
id string
The ID of the SSH Key.
created This property is required. str
The date this key was added.
label This property is required. str
The label of the SSH Key.
ssh_key This property is required. str
The public SSH Key, which is used to authenticate to the root user of the Linodes you deploy.
id str
The ID of the SSH Key.
created This property is required. String
The date this key was added.
label This property is required. String
The label of the SSH Key.
sshKey This property is required. String
The public SSH Key, which is used to authenticate to the root user of the Linodes you deploy.
id String
The ID of the SSH Key.

Package Details

Repository
Linode pulumi/pulumi-linode
License
Apache-2.0
Notes
This Pulumi package is based on the linode Terraform Provider.