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

tencentcloud.getKmsPublicKey

Explore with Pulumi AI

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

    Use this data source to query detailed information of kms public_key

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const exampleKmsKey = new tencentcloud.KmsKey("exampleKmsKey", {
        alias: "tf-example-kms-key",
        description: "example of kms key",
        keyUsage: "ASYMMETRIC_DECRYPT_RSA_2048",
        isEnabled: true,
        pendingDeleteWindowInDays: 7,
    });
    const exampleKmsPublicKey = tencentcloud.getKmsPublicKeyOutput({
        keyId: exampleKmsKey.kmsKeyId,
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    example_kms_key = tencentcloud.KmsKey("exampleKmsKey",
        alias="tf-example-kms-key",
        description="example of kms key",
        key_usage="ASYMMETRIC_DECRYPT_RSA_2048",
        is_enabled=True,
        pending_delete_window_in_days=7)
    example_kms_public_key = tencentcloud.get_kms_public_key_output(key_id=example_kms_key.kms_key_id)
    
    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 {
    		exampleKmsKey, err := tencentcloud.NewKmsKey(ctx, "exampleKmsKey", &tencentcloud.KmsKeyArgs{
    			Alias:                     pulumi.String("tf-example-kms-key"),
    			Description:               pulumi.String("example of kms key"),
    			KeyUsage:                  pulumi.String("ASYMMETRIC_DECRYPT_RSA_2048"),
    			IsEnabled:                 pulumi.Bool(true),
    			PendingDeleteWindowInDays: pulumi.Float64(7),
    		})
    		if err != nil {
    			return err
    		}
    		_ = tencentcloud.GetKmsPublicKeyOutput(ctx, tencentcloud.GetKmsPublicKeyOutputArgs{
    			KeyId: exampleKmsKey.KmsKeyId,
    		}, nil)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleKmsKey = new Tencentcloud.KmsKey("exampleKmsKey", new()
        {
            Alias = "tf-example-kms-key",
            Description = "example of kms key",
            KeyUsage = "ASYMMETRIC_DECRYPT_RSA_2048",
            IsEnabled = true,
            PendingDeleteWindowInDays = 7,
        });
    
        var exampleKmsPublicKey = Tencentcloud.GetKmsPublicKey.Invoke(new()
        {
            KeyId = exampleKmsKey.KmsKeyId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.KmsKey;
    import com.pulumi.tencentcloud.KmsKeyArgs;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetKmsPublicKeyArgs;
    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 exampleKmsKey = new KmsKey("exampleKmsKey", KmsKeyArgs.builder()
                .alias("tf-example-kms-key")
                .description("example of kms key")
                .keyUsage("ASYMMETRIC_DECRYPT_RSA_2048")
                .isEnabled(true)
                .pendingDeleteWindowInDays(7)
                .build());
    
            final var exampleKmsPublicKey = TencentcloudFunctions.getKmsPublicKey(GetKmsPublicKeyArgs.builder()
                .keyId(exampleKmsKey.kmsKeyId())
                .build());
    
        }
    }
    
    resources:
      exampleKmsKey:
        type: tencentcloud:KmsKey
        properties:
          alias: tf-example-kms-key
          description: example of kms key
          keyUsage: ASYMMETRIC_DECRYPT_RSA_2048
          isEnabled: true
          pendingDeleteWindowInDays: 7
    variables:
      exampleKmsPublicKey:
        fn::invoke:
          function: tencentcloud:getKmsPublicKey
          arguments:
            keyId: ${exampleKmsKey.kmsKeyId}
    

    Using getKmsPublicKey

    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 getKmsPublicKey(args: GetKmsPublicKeyArgs, opts?: InvokeOptions): Promise<GetKmsPublicKeyResult>
    function getKmsPublicKeyOutput(args: GetKmsPublicKeyOutputArgs, opts?: InvokeOptions): Output<GetKmsPublicKeyResult>
    def get_kms_public_key(id: Optional[str] = None,
                           key_id: Optional[str] = None,
                           result_output_file: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetKmsPublicKeyResult
    def get_kms_public_key_output(id: Optional[pulumi.Input[str]] = None,
                           key_id: Optional[pulumi.Input[str]] = None,
                           result_output_file: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetKmsPublicKeyResult]
    func GetKmsPublicKey(ctx *Context, args *GetKmsPublicKeyArgs, opts ...InvokeOption) (*GetKmsPublicKeyResult, error)
    func GetKmsPublicKeyOutput(ctx *Context, args *GetKmsPublicKeyOutputArgs, opts ...InvokeOption) GetKmsPublicKeyResultOutput

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

    public static class GetKmsPublicKey 
    {
        public static Task<GetKmsPublicKeyResult> InvokeAsync(GetKmsPublicKeyArgs args, InvokeOptions? opts = null)
        public static Output<GetKmsPublicKeyResult> Invoke(GetKmsPublicKeyInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetKmsPublicKeyResult> getKmsPublicKey(GetKmsPublicKeyArgs args, InvokeOptions options)
    public static Output<GetKmsPublicKeyResult> getKmsPublicKey(GetKmsPublicKeyArgs args, InvokeOptions options)
    
    fn::invoke:
      function: tencentcloud:index/getKmsPublicKey:getKmsPublicKey
      arguments:
        # arguments dictionary

    The following arguments are supported:

    KeyId string
    CMK unique identifier.
    Id string
    ResultOutputFile string
    Used to save results.
    KeyId string
    CMK unique identifier.
    Id string
    ResultOutputFile string
    Used to save results.
    keyId String
    CMK unique identifier.
    id String
    resultOutputFile String
    Used to save results.
    keyId string
    CMK unique identifier.
    id string
    resultOutputFile string
    Used to save results.
    key_id str
    CMK unique identifier.
    id str
    result_output_file str
    Used to save results.
    keyId String
    CMK unique identifier.
    id String
    resultOutputFile String
    Used to save results.

    getKmsPublicKey Result

    The following output properties are available:

    Id string
    KeyId string
    PublicKey string
    Base64-encoded public key content.
    PublicKeyPem string
    Public key content in PEM format.
    ResultOutputFile string
    Id string
    KeyId string
    PublicKey string
    Base64-encoded public key content.
    PublicKeyPem string
    Public key content in PEM format.
    ResultOutputFile string
    id String
    keyId String
    publicKey String
    Base64-encoded public key content.
    publicKeyPem String
    Public key content in PEM format.
    resultOutputFile String
    id string
    keyId string
    publicKey string
    Base64-encoded public key content.
    publicKeyPem string
    Public key content in PEM format.
    resultOutputFile string
    id str
    key_id str
    public_key str
    Base64-encoded public key content.
    public_key_pem str
    Public key content in PEM format.
    result_output_file str
    id String
    keyId String
    publicKey String
    Base64-encoded public key content.
    publicKeyPem String
    Public key content in PEM format.
    resultOutputFile String

    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