1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. getKeyPairs
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

tencentcloud.getKeyPairs

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    Use this data source to query key pairs.

    Example Usage

    Query key pairs by key ID

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const keyId = tencentcloud.getKeyPairs({
        keyId: "skey-ie97i3ml",
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    key_id = tencentcloud.get_key_pairs(key_id="skey-ie97i3ml")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := tencentcloud.GetKeyPairs(ctx, &tencentcloud.GetKeyPairsArgs{
    			KeyId: pulumi.StringRef("skey-ie97i3ml"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var keyId = Tencentcloud.GetKeyPairs.Invoke(new()
        {
            KeyId = "skey-ie97i3ml",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetKeyPairsArgs;
    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 keyId = TencentcloudFunctions.getKeyPairs(GetKeyPairsArgs.builder()
                .keyId("skey-ie97i3ml")
                .build());
    
        }
    }
    
    variables:
      keyId:
        fn::invoke:
          function: tencentcloud:getKeyPairs
          arguments:
            keyId: skey-ie97i3ml
    

    Query key pairs by key name

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const keyName = tencentcloud.getKeyPairs({
        keyName: "^test$",
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    key_name = tencentcloud.get_key_pairs(key_name="^test$")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := tencentcloud.GetKeyPairs(ctx, &tencentcloud.GetKeyPairsArgs{
    			KeyName: pulumi.StringRef("^test$"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var keyName = Tencentcloud.GetKeyPairs.Invoke(new()
        {
            KeyName = "^test$",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetKeyPairsArgs;
    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 keyName = TencentcloudFunctions.getKeyPairs(GetKeyPairsArgs.builder()
                .keyName("^test$")
                .build());
    
        }
    }
    
    variables:
      keyName:
        fn::invoke:
          function: tencentcloud:getKeyPairs
          arguments:
            keyName: ^test$
    

    Using getKeyPairs

    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 getKeyPairs(args: GetKeyPairsArgs, opts?: InvokeOptions): Promise<GetKeyPairsResult>
    function getKeyPairsOutput(args: GetKeyPairsOutputArgs, opts?: InvokeOptions): Output<GetKeyPairsResult>
    def get_key_pairs(id: Optional[str] = None,
                      key_id: Optional[str] = None,
                      key_name: Optional[str] = None,
                      project_id: Optional[float] = None,
                      result_output_file: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetKeyPairsResult
    def get_key_pairs_output(id: Optional[pulumi.Input[str]] = None,
                      key_id: Optional[pulumi.Input[str]] = None,
                      key_name: Optional[pulumi.Input[str]] = None,
                      project_id: Optional[pulumi.Input[float]] = None,
                      result_output_file: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetKeyPairsResult]
    func GetKeyPairs(ctx *Context, args *GetKeyPairsArgs, opts ...InvokeOption) (*GetKeyPairsResult, error)
    func GetKeyPairsOutput(ctx *Context, args *GetKeyPairsOutputArgs, opts ...InvokeOption) GetKeyPairsResultOutput

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

    public static class GetKeyPairs 
    {
        public static Task<GetKeyPairsResult> InvokeAsync(GetKeyPairsArgs args, InvokeOptions? opts = null)
        public static Output<GetKeyPairsResult> Invoke(GetKeyPairsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetKeyPairsResult> getKeyPairs(GetKeyPairsArgs args, InvokeOptions options)
    public static Output<GetKeyPairsResult> getKeyPairs(GetKeyPairsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: tencentcloud:index/getKeyPairs:getKeyPairs
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    KeyId string
    ID of the key pair to be queried.
    KeyName string
    Name of the key pair to be queried. Support regular expression search, only ^ and $ are supported.
    ProjectId double
    Project ID of the key pair to be queried.
    ResultOutputFile string
    Used to save results.
    Id string
    KeyId string
    ID of the key pair to be queried.
    KeyName string
    Name of the key pair to be queried. Support regular expression search, only ^ and $ are supported.
    ProjectId float64
    Project ID of the key pair to be queried.
    ResultOutputFile string
    Used to save results.
    id String
    keyId String
    ID of the key pair to be queried.
    keyName String
    Name of the key pair to be queried. Support regular expression search, only ^ and $ are supported.
    projectId Double
    Project ID of the key pair to be queried.
    resultOutputFile String
    Used to save results.
    id string
    keyId string
    ID of the key pair to be queried.
    keyName string
    Name of the key pair to be queried. Support regular expression search, only ^ and $ are supported.
    projectId number
    Project ID of the key pair to be queried.
    resultOutputFile string
    Used to save results.
    id str
    key_id str
    ID of the key pair to be queried.
    key_name str
    Name of the key pair to be queried. Support regular expression search, only ^ and $ are supported.
    project_id float
    Project ID of the key pair to be queried.
    result_output_file str
    Used to save results.
    id String
    keyId String
    ID of the key pair to be queried.
    keyName String
    Name of the key pair to be queried. Support regular expression search, only ^ and $ are supported.
    projectId Number
    Project ID of the key pair to be queried.
    resultOutputFile String
    Used to save results.

    getKeyPairs Result

    The following output properties are available:

    Id string
    KeyPairLists List<GetKeyPairsKeyPairList>
    An information list of key pair. Each element contains the following attributes:
    KeyId string
    ID of the key pair.
    KeyName string
    Name of the key pair.
    ProjectId double
    Project ID of the key pair.
    ResultOutputFile string
    Id string
    KeyPairLists []GetKeyPairsKeyPairList
    An information list of key pair. Each element contains the following attributes:
    KeyId string
    ID of the key pair.
    KeyName string
    Name of the key pair.
    ProjectId float64
    Project ID of the key pair.
    ResultOutputFile string
    id String
    keyPairLists List<GetKeyPairsKeyPairList>
    An information list of key pair. Each element contains the following attributes:
    keyId String
    ID of the key pair.
    keyName String
    Name of the key pair.
    projectId Double
    Project ID of the key pair.
    resultOutputFile String
    id string
    keyPairLists GetKeyPairsKeyPairList[]
    An information list of key pair. Each element contains the following attributes:
    keyId string
    ID of the key pair.
    keyName string
    Name of the key pair.
    projectId number
    Project ID of the key pair.
    resultOutputFile string
    id str
    key_pair_lists Sequence[GetKeyPairsKeyPairList]
    An information list of key pair. Each element contains the following attributes:
    key_id str
    ID of the key pair.
    key_name str
    Name of the key pair.
    project_id float
    Project ID of the key pair.
    result_output_file str
    id String
    keyPairLists List<Property Map>
    An information list of key pair. Each element contains the following attributes:
    keyId String
    ID of the key pair.
    keyName String
    Name of the key pair.
    projectId Number
    Project ID of the key pair.
    resultOutputFile String

    Supporting Types

    GetKeyPairsKeyPairList

    CreateTime string
    Creation time of the key pair.
    KeyId string
    ID of the key pair to be queried.
    KeyName string
    Name of the key pair to be queried. Support regular expression search, only ^ and $ are supported.
    ProjectId double
    Project ID of the key pair to be queried.
    PublicKey string
    public key of the key pair.
    CreateTime string
    Creation time of the key pair.
    KeyId string
    ID of the key pair to be queried.
    KeyName string
    Name of the key pair to be queried. Support regular expression search, only ^ and $ are supported.
    ProjectId float64
    Project ID of the key pair to be queried.
    PublicKey string
    public key of the key pair.
    createTime String
    Creation time of the key pair.
    keyId String
    ID of the key pair to be queried.
    keyName String
    Name of the key pair to be queried. Support regular expression search, only ^ and $ are supported.
    projectId Double
    Project ID of the key pair to be queried.
    publicKey String
    public key of the key pair.
    createTime string
    Creation time of the key pair.
    keyId string
    ID of the key pair to be queried.
    keyName string
    Name of the key pair to be queried. Support regular expression search, only ^ and $ are supported.
    projectId number
    Project ID of the key pair to be queried.
    publicKey string
    public key of the key pair.
    create_time str
    Creation time of the key pair.
    key_id str
    ID of the key pair to be queried.
    key_name str
    Name of the key pair to be queried. Support regular expression search, only ^ and $ are supported.
    project_id float
    Project ID of the key pair to be queried.
    public_key str
    public key of the key pair.
    createTime String
    Creation time of the key pair.
    keyId String
    ID of the key pair to be queried.
    keyName String
    Name of the key pair to be queried. Support regular expression search, only ^ and $ are supported.
    projectId Number
    Project ID of the key pair to be queried.
    publicKey String
    public key of the key pair.

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack