Google Cloud v8.27.0 published on Thursday, Apr 17, 2025 by Pulumi
gcp.kms.getKeyHandle
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const myKeyHandle = gcp.kms.getKeyHandle({
    name: "eed58b7b-20ad-4da8-ad85-ba78a0d5ab87",
    location: "us-central1",
});
import pulumi
import pulumi_gcp as gcp
my_key_handle = gcp.kms.get_key_handle(name="eed58b7b-20ad-4da8-ad85-ba78a0d5ab87",
    location="us-central1")
package main
import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/kms"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := kms.LookupKeyHandle(ctx, &kms.LookupKeyHandleArgs{
			Name:     "eed58b7b-20ad-4da8-ad85-ba78a0d5ab87",
			Location: "us-central1",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() => 
{
    var myKeyHandle = Gcp.Kms.GetKeyHandle.Invoke(new()
    {
        Name = "eed58b7b-20ad-4da8-ad85-ba78a0d5ab87",
        Location = "us-central1",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.kms.KmsFunctions;
import com.pulumi.gcp.kms.inputs.GetKeyHandleArgs;
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 myKeyHandle = KmsFunctions.getKeyHandle(GetKeyHandleArgs.builder()
            .name("eed58b7b-20ad-4da8-ad85-ba78a0d5ab87")
            .location("us-central1")
            .build());
    }
}
variables:
  myKeyHandle:
    fn::invoke:
      function: gcp:kms:getKeyHandle
      arguments:
        name: eed58b7b-20ad-4da8-ad85-ba78a0d5ab87
        location: us-central1
Using getKeyHandle
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 getKeyHandle(args: GetKeyHandleArgs, opts?: InvokeOptions): Promise<GetKeyHandleResult>
function getKeyHandleOutput(args: GetKeyHandleOutputArgs, opts?: InvokeOptions): Output<GetKeyHandleResult>def get_key_handle(location: Optional[str] = None,
                   name: Optional[str] = None,
                   project: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetKeyHandleResult
def get_key_handle_output(location: Optional[pulumi.Input[str]] = None,
                   name: Optional[pulumi.Input[str]] = None,
                   project: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetKeyHandleResult]func LookupKeyHandle(ctx *Context, args *LookupKeyHandleArgs, opts ...InvokeOption) (*LookupKeyHandleResult, error)
func LookupKeyHandleOutput(ctx *Context, args *LookupKeyHandleOutputArgs, opts ...InvokeOption) LookupKeyHandleResultOutput> Note: This function is named LookupKeyHandle in the Go SDK.
public static class GetKeyHandle 
{
    public static Task<GetKeyHandleResult> InvokeAsync(GetKeyHandleArgs args, InvokeOptions? opts = null)
    public static Output<GetKeyHandleResult> Invoke(GetKeyHandleInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetKeyHandleResult> getKeyHandle(GetKeyHandleArgs args, InvokeOptions options)
public static Output<GetKeyHandleResult> getKeyHandle(GetKeyHandleArgs args, InvokeOptions options)
fn::invoke:
  function: gcp:kms/getKeyHandle:getKeyHandle
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Location string
 - The Google Cloud Platform location for the KeyHandle.
A full list of valid locations can be found by running 
gcloud kms locations list. - Name string
 - The KeyHandle's name. A KeyHandle name must exist within the provided location and must be valid UUID.
 - Project string
 - The project in which the resource belongs. If it is not provided, the provider project is used.
 
- Location string
 - The Google Cloud Platform location for the KeyHandle.
A full list of valid locations can be found by running 
gcloud kms locations list. - Name string
 - The KeyHandle's name. A KeyHandle name must exist within the provided location and must be valid UUID.
 - Project string
 - The project in which the resource belongs. If it is not provided, the provider project is used.
 
- location String
 - The Google Cloud Platform location for the KeyHandle.
A full list of valid locations can be found by running 
gcloud kms locations list. - name String
 - The KeyHandle's name. A KeyHandle name must exist within the provided location and must be valid UUID.
 - project String
 - The project in which the resource belongs. If it is not provided, the provider project is used.
 
- location string
 - The Google Cloud Platform location for the KeyHandle.
A full list of valid locations can be found by running 
gcloud kms locations list. - name string
 - The KeyHandle's name. A KeyHandle name must exist within the provided location and must be valid UUID.
 - project string
 - The project in which the resource belongs. If it is not provided, the provider project is used.
 
- location str
 - The Google Cloud Platform location for the KeyHandle.
A full list of valid locations can be found by running 
gcloud kms locations list. - name str
 - The KeyHandle's name. A KeyHandle name must exist within the provided location and must be valid UUID.
 - project str
 - The project in which the resource belongs. If it is not provided, the provider project is used.
 
- location String
 - The Google Cloud Platform location for the KeyHandle.
A full list of valid locations can be found by running 
gcloud kms locations list. - name String
 - The KeyHandle's name. A KeyHandle name must exist within the provided location and must be valid UUID.
 - project String
 - The project in which the resource belongs. If it is not provided, the provider project is used.
 
getKeyHandle Result
The following output properties are available:
- Id string
 - The provider-assigned unique ID for this managed resource.
 - Kms
Key string - The identifier of the KMS Key created for the KeyHandle. Its format is 
projects/{projectId}/locations/{location}/keyRings/{keyRingName}/cryptoKeys/{cryptoKeyName}. - Location string
 - The location of the KMS Key and KeyHandle.
 - Name string
 - Resource
Type stringSelector  - Indicates the resource type that the resulting CryptoKey is meant to protect, e.g. {SERVICE}.googleapis.com/{TYPE}. See documentation for supported resource types.
 - Project string
 - The identifier of the project where KMS KeyHandle is created.
 
- Id string
 - The provider-assigned unique ID for this managed resource.
 - Kms
Key string - The identifier of the KMS Key created for the KeyHandle. Its format is 
projects/{projectId}/locations/{location}/keyRings/{keyRingName}/cryptoKeys/{cryptoKeyName}. - Location string
 - The location of the KMS Key and KeyHandle.
 - Name string
 - Resource
Type stringSelector  - Indicates the resource type that the resulting CryptoKey is meant to protect, e.g. {SERVICE}.googleapis.com/{TYPE}. See documentation for supported resource types.
 - Project string
 - The identifier of the project where KMS KeyHandle is created.
 
- id String
 - The provider-assigned unique ID for this managed resource.
 - kms
Key String - The identifier of the KMS Key created for the KeyHandle. Its format is 
projects/{projectId}/locations/{location}/keyRings/{keyRingName}/cryptoKeys/{cryptoKeyName}. - location String
 - The location of the KMS Key and KeyHandle.
 - name String
 - resource
Type StringSelector  - Indicates the resource type that the resulting CryptoKey is meant to protect, e.g. {SERVICE}.googleapis.com/{TYPE}. See documentation for supported resource types.
 - project String
 - The identifier of the project where KMS KeyHandle is created.
 
- id string
 - The provider-assigned unique ID for this managed resource.
 - kms
Key string - The identifier of the KMS Key created for the KeyHandle. Its format is 
projects/{projectId}/locations/{location}/keyRings/{keyRingName}/cryptoKeys/{cryptoKeyName}. - location string
 - The location of the KMS Key and KeyHandle.
 - name string
 - resource
Type stringSelector  - Indicates the resource type that the resulting CryptoKey is meant to protect, e.g. {SERVICE}.googleapis.com/{TYPE}. See documentation for supported resource types.
 - project string
 - The identifier of the project where KMS KeyHandle is created.
 
- id str
 - The provider-assigned unique ID for this managed resource.
 - kms_
key str - The identifier of the KMS Key created for the KeyHandle. Its format is 
projects/{projectId}/locations/{location}/keyRings/{keyRingName}/cryptoKeys/{cryptoKeyName}. - location str
 - The location of the KMS Key and KeyHandle.
 - name str
 - resource_
type_ strselector  - Indicates the resource type that the resulting CryptoKey is meant to protect, e.g. {SERVICE}.googleapis.com/{TYPE}. See documentation for supported resource types.
 - project str
 - The identifier of the project where KMS KeyHandle is created.
 
- id String
 - The provider-assigned unique ID for this managed resource.
 - kms
Key String - The identifier of the KMS Key created for the KeyHandle. Its format is 
projects/{projectId}/locations/{location}/keyRings/{keyRingName}/cryptoKeys/{cryptoKeyName}. - location String
 - The location of the KMS Key and KeyHandle.
 - name String
 - resource
Type StringSelector  - Indicates the resource type that the resulting CryptoKey is meant to protect, e.g. {SERVICE}.googleapis.com/{TYPE}. See documentation for supported resource types.
 - project String
 - The identifier of the project where KMS KeyHandle is created.
 
Package Details
- Repository
 - Google Cloud (GCP) Classic pulumi/pulumi-gcp
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
google-betaTerraform Provider.