1. Packages
  2. Vultr
  3. API Docs
  4. getSshKey
Vultr v2.19.0 published on Friday, Jan 5, 2024 by dirien

vultr.getSshKey

Explore with Pulumi AI

vultr logo
Vultr v2.19.0 published on Friday, Jan 5, 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

    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",
                    },
                },
            },
        });
    
    });
    
    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
    	})
    }
    
    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());
    
        }
    }
    
    import pulumi
    import pulumi_vultr as vultr
    
    my_ssh_key = vultr.get_ssh_key(filters=[vultr.GetSshKeyFilterArgs(
        name="name",
        values=["my-ssh-key-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"],
        }],
    });
    
    variables:
      mySshKey:
        fn::invoke:
          Function: vultr:getSshKey
          Arguments:
            filters:
              - name: name
                values:
                  - my-ssh-key-name
    

    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>
    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]
    func GetSshKey(ctx *Context, args *GetSshKeyArgs, opts ...InvokeOption) (*GetSshKeyResult, error)
    func GetSshKeyOutput(ctx *Context, args *GetSshKeyOutputArgs, opts ...InvokeOption) GetSshKeyResultOutput

    > 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)
    }
    public static CompletableFuture<GetSshKeyResult> getSshKey(GetSshKeyArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: vultr:index/getSshKey:getSshKey
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<ediri.Vultr.Inputs.GetSshKeyFilter>
    Query parameters for finding SSH keys.
    Filters []GetSshKeyFilter
    Query parameters for finding SSH keys.
    filters List<GetSshKeyFilter>
    Query parameters for finding SSH keys.
    filters GetSshKeyFilter[]
    Query parameters for finding SSH keys.
    filters Sequence[GetSshKeyFilter]
    Query parameters for finding SSH keys.
    filters 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 string
    Attribute name to filter with.
    Values List<string>
    One or more values filter with.
    Name string
    Attribute name to filter with.
    Values []string
    One or more values filter with.
    name String
    Attribute name to filter with.
    values List<String>
    One or more values filter with.
    name string
    Attribute name to filter with.
    values string[]
    One or more values filter with.
    name str
    Attribute name to filter with.
    values Sequence[str]
    One or more values filter with.
    name String
    Attribute name to filter with.
    values 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 logo
    Vultr v2.19.0 published on Friday, Jan 5, 2024 by dirien