1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. kms
  5. getKeyHandle
Google Cloud v8.26.0 published on Thursday, Apr 10, 2025 by Pulumi

gcp.kms.getKeyHandle

Explore with Pulumi AI

Google Cloud v8.26.0 published on Thursday, Apr 10, 2025 by Pulumi

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",
});
Copy
import pulumi
import pulumi_gcp as gcp

my_key_handle = gcp.kms.get_key_handle(name="eed58b7b-20ad-4da8-ad85-ba78a0d5ab87",
    location="us-central1")
Copy
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
	})
}
Copy
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",
    });

});
Copy
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());

    }
}
Copy
variables:
  myKeyHandle:
    fn::invoke:
      function: gcp:kms:getKeyHandle
      arguments:
        name: eed58b7b-20ad-4da8-ad85-ba78a0d5ab87
        location: us-central1
Copy

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>
Copy
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]
Copy
func LookupKeyHandle(ctx *Context, args *LookupKeyHandleArgs, opts ...InvokeOption) (*LookupKeyHandleResult, error)
func LookupKeyHandleOutput(ctx *Context, args *LookupKeyHandleOutputArgs, opts ...InvokeOption) LookupKeyHandleResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetKeyHandleResult> getKeyHandle(GetKeyHandleArgs args, InvokeOptions options)
public static Output<GetKeyHandleResult> getKeyHandle(GetKeyHandleArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: gcp:kms/getKeyHandle:getKeyHandle
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Location This property is required. 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 This property is required. 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 This property is required. 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 This property is required. 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 This property is required. 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 This property is required. 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 This property is required. 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 This property is required. 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 This property is required. 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 This property is required. 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 This property is required. 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 This property is required. 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.
KmsKey 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
ResourceTypeSelector string
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.
KmsKey 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
ResourceTypeSelector string
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.
kmsKey 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
resourceTypeSelector String
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.
kmsKey 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
resourceTypeSelector string
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_selector str
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.
kmsKey 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
resourceTypeSelector String
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-beta Terraform Provider.
Google Cloud v8.26.0 published on Thursday, Apr 10, 2025 by Pulumi