Google Cloud (GCP) Classic

Pulumi Official
Package maintained by Pulumi
v6.32.0 published on Wednesday, Jul 20, 2022 by Pulumi

getKMSCryptoKeyVersion

Provides access to a Google Cloud Platform KMS CryptoKeyVersion. For more information see the official documentation and API.

A CryptoKeyVersion represents an individual cryptographic key, and the associated key material.

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var myKeyRing = Output.Create(Gcp.Kms.GetKMSKeyRing.InvokeAsync(new Gcp.Kms.GetKMSKeyRingArgs
        {
            Name = "my-key-ring",
            Location = "us-central1",
        }));
        var myCryptoKey = myKeyRing.Apply(myKeyRing => Output.Create(Gcp.Kms.GetKMSCryptoKey.InvokeAsync(new Gcp.Kms.GetKMSCryptoKeyArgs
        {
            Name = "my-crypto-key",
            KeyRing = myKeyRing.Id,
        })));
        var myCryptoKeyVersion = Output.Create(Gcp.Kms.GetKMSCryptoKeyVersion.InvokeAsync(new Gcp.Kms.GetKMSCryptoKeyVersionArgs
        {
            CryptoKey = data.Google_kms_crypto_key.My_key.Id,
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/kms"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		myKeyRing, err := kms.GetKMSKeyRing(ctx, &kms.GetKMSKeyRingArgs{
			Name:     "my-key-ring",
			Location: "us-central1",
		}, nil)
		if err != nil {
			return err
		}
		_, err = kms.GetKMSCryptoKey(ctx, &kms.GetKMSCryptoKeyArgs{
			Name:    "my-crypto-key",
			KeyRing: myKeyRing.Id,
		}, nil)
		if err != nil {
			return err
		}
		_, err = kms.GetKMSCryptoKeyVersion(ctx, &kms.GetKMSCryptoKeyVersionArgs{
			CryptoKey: data.Google_kms_crypto_key.My_key.Id,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var myKeyRing = Output.of(KmsFunctions.getKMSKeyRing(GetKMSKeyRingArgs.builder()
            .name("my-key-ring")
            .location("us-central1")
            .build()));

        final var myCryptoKey = Output.of(KmsFunctions.getKMSCryptoKey(GetKMSCryptoKeyArgs.builder()
            .name("my-crypto-key")
            .keyRing(myKeyRing.apply(getKMSKeyRingResult -> getKMSKeyRingResult.id()))
            .build()));

        final var myCryptoKeyVersion = Output.of(KmsFunctions.getKMSCryptoKeyVersion(GetKMSCryptoKeyVersionArgs.builder()
            .cryptoKey(data.google_kms_crypto_key().my_key().id())
            .build()));

    }
}
import pulumi
import pulumi_gcp as gcp

my_key_ring = gcp.kms.get_kms_key_ring(name="my-key-ring",
    location="us-central1")
my_crypto_key = gcp.kms.get_kms_crypto_key(name="my-crypto-key",
    key_ring=my_key_ring.id)
my_crypto_key_version = gcp.kms.get_kms_crypto_key_version(crypto_key=data["google_kms_crypto_key"]["my_key"]["id"])
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const myKeyRing = gcp.kms.getKMSKeyRing({
    name: "my-key-ring",
    location: "us-central1",
});
const myCryptoKey = myKeyRing.then(myKeyRing => gcp.kms.getKMSCryptoKey({
    name: "my-crypto-key",
    keyRing: myKeyRing.id,
}));
const myCryptoKeyVersion = gcp.kms.getKMSCryptoKeyVersion({
    cryptoKey: data.google_kms_crypto_key.my_key.id,
});
variables:
  myKeyRing:
    Fn::Invoke:
      Function: gcp:kms:getKMSKeyRing
      Arguments:
        name: my-key-ring
        location: us-central1
  myCryptoKey:
    Fn::Invoke:
      Function: gcp:kms:getKMSCryptoKey
      Arguments:
        name: my-crypto-key
        keyRing: ${myKeyRing.id}
  myCryptoKeyVersion:
    Fn::Invoke:
      Function: gcp:kms:getKMSCryptoKeyVersion
      Arguments:
        cryptoKey: ${data.google_kms_crypto_key.my_key.id}

Using getKMSCryptoKeyVersion

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 getKMSCryptoKeyVersion(args: GetKMSCryptoKeyVersionArgs, opts?: InvokeOptions): Promise<GetKMSCryptoKeyVersionResult>
function getKMSCryptoKeyVersionOutput(args: GetKMSCryptoKeyVersionOutputArgs, opts?: InvokeOptions): Output<GetKMSCryptoKeyVersionResult>
def get_kms_crypto_key_version(crypto_key: Optional[str] = None,
                               version: Optional[int] = None,
                               opts: Optional[InvokeOptions] = None) -> GetKMSCryptoKeyVersionResult
def get_kms_crypto_key_version_output(crypto_key: Optional[pulumi.Input[str]] = None,
                               version: Optional[pulumi.Input[int]] = None,
                               opts: Optional[InvokeOptions] = None) -> Output[GetKMSCryptoKeyVersionResult]
func GetKMSCryptoKeyVersion(ctx *Context, args *GetKMSCryptoKeyVersionArgs, opts ...InvokeOption) (*GetKMSCryptoKeyVersionResult, error)
func GetKMSCryptoKeyVersionOutput(ctx *Context, args *GetKMSCryptoKeyVersionOutputArgs, opts ...InvokeOption) GetKMSCryptoKeyVersionResultOutput

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

public static class GetKMSCryptoKeyVersion 
{
    public static Task<GetKMSCryptoKeyVersionResult> InvokeAsync(GetKMSCryptoKeyVersionArgs args, InvokeOptions? opts = null)
    public static Output<GetKMSCryptoKeyVersionResult> Invoke(GetKMSCryptoKeyVersionInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetKMSCryptoKeyVersionResult> getKMSCryptoKeyVersion(GetKMSCryptoKeyVersionArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: gcp:kms/getKMSCryptoKeyVersion:getKMSCryptoKeyVersion
  Arguments:
    # Arguments dictionary

The following arguments are supported:

CryptoKey string

The id of the Google Cloud Platform CryptoKey to which the key version belongs. This is also the id field of the gcp.kms.CryptoKey resource/datasource.

Version int

The version number for this CryptoKeyVersion. Defaults to 1.

CryptoKey string

The id of the Google Cloud Platform CryptoKey to which the key version belongs. This is also the id field of the gcp.kms.CryptoKey resource/datasource.

Version int

The version number for this CryptoKeyVersion. Defaults to 1.

cryptoKey String

The id of the Google Cloud Platform CryptoKey to which the key version belongs. This is also the id field of the gcp.kms.CryptoKey resource/datasource.

version Integer

The version number for this CryptoKeyVersion. Defaults to 1.

cryptoKey string

The id of the Google Cloud Platform CryptoKey to which the key version belongs. This is also the id field of the gcp.kms.CryptoKey resource/datasource.

version number

The version number for this CryptoKeyVersion. Defaults to 1.

crypto_key str

The id of the Google Cloud Platform CryptoKey to which the key version belongs. This is also the id field of the gcp.kms.CryptoKey resource/datasource.

version int

The version number for this CryptoKeyVersion. Defaults to 1.

cryptoKey String

The id of the Google Cloud Platform CryptoKey to which the key version belongs. This is also the id field of the gcp.kms.CryptoKey resource/datasource.

version Number

The version number for this CryptoKeyVersion. Defaults to 1.

getKMSCryptoKeyVersion Result

The following output properties are available:

Algorithm string

The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.

CryptoKey string
Id string

The provider-assigned unique ID for this managed resource.

Name string

The resource name for this CryptoKeyVersion in the format projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*

ProtectionLevel string

The ProtectionLevel describing how crypto operations are performed with this CryptoKeyVersion. See the protection_level reference for possible outputs.

PublicKeys List<GetKMSCryptoKeyVersionPublicKey>

If the enclosing CryptoKey has purpose ASYMMETRIC_SIGN or ASYMMETRIC_DECRYPT, this block contains details about the public key associated to this CryptoKeyVersion. Structure is documented below.

State string

The current state of the CryptoKeyVersion. See the state reference for possible outputs.

Version int
Algorithm string

The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.

CryptoKey string
Id string

The provider-assigned unique ID for this managed resource.

Name string

The resource name for this CryptoKeyVersion in the format projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*

ProtectionLevel string

The ProtectionLevel describing how crypto operations are performed with this CryptoKeyVersion. See the protection_level reference for possible outputs.

PublicKeys []GetKMSCryptoKeyVersionPublicKey

If the enclosing CryptoKey has purpose ASYMMETRIC_SIGN or ASYMMETRIC_DECRYPT, this block contains details about the public key associated to this CryptoKeyVersion. Structure is documented below.

State string

The current state of the CryptoKeyVersion. See the state reference for possible outputs.

Version int
algorithm String

The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.

cryptoKey String
id String

The provider-assigned unique ID for this managed resource.

name String

The resource name for this CryptoKeyVersion in the format projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*

protectionLevel String

The ProtectionLevel describing how crypto operations are performed with this CryptoKeyVersion. See the protection_level reference for possible outputs.

publicKeys List<GetKMSCryptoKeyVersionPublicKey>

If the enclosing CryptoKey has purpose ASYMMETRIC_SIGN or ASYMMETRIC_DECRYPT, this block contains details about the public key associated to this CryptoKeyVersion. Structure is documented below.

state String

The current state of the CryptoKeyVersion. See the state reference for possible outputs.

version Integer
algorithm string

The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.

cryptoKey string
id string

The provider-assigned unique ID for this managed resource.

name string

The resource name for this CryptoKeyVersion in the format projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*

protectionLevel string

The ProtectionLevel describing how crypto operations are performed with this CryptoKeyVersion. See the protection_level reference for possible outputs.

publicKeys GetKMSCryptoKeyVersionPublicKey[]

If the enclosing CryptoKey has purpose ASYMMETRIC_SIGN or ASYMMETRIC_DECRYPT, this block contains details about the public key associated to this CryptoKeyVersion. Structure is documented below.

state string

The current state of the CryptoKeyVersion. See the state reference for possible outputs.

version number
algorithm str

The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.

crypto_key str
id str

The provider-assigned unique ID for this managed resource.

name str

The resource name for this CryptoKeyVersion in the format projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*

protection_level str

The ProtectionLevel describing how crypto operations are performed with this CryptoKeyVersion. See the protection_level reference for possible outputs.

public_keys Sequence[GetKMSCryptoKeyVersionPublicKey]

If the enclosing CryptoKey has purpose ASYMMETRIC_SIGN or ASYMMETRIC_DECRYPT, this block contains details about the public key associated to this CryptoKeyVersion. Structure is documented below.

state str

The current state of the CryptoKeyVersion. See the state reference for possible outputs.

version int
algorithm String

The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.

cryptoKey String
id String

The provider-assigned unique ID for this managed resource.

name String

The resource name for this CryptoKeyVersion in the format projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*

protectionLevel String

The ProtectionLevel describing how crypto operations are performed with this CryptoKeyVersion. See the protection_level reference for possible outputs.

publicKeys List<Property Map>

If the enclosing CryptoKey has purpose ASYMMETRIC_SIGN or ASYMMETRIC_DECRYPT, this block contains details about the public key associated to this CryptoKeyVersion. Structure is documented below.

state String

The current state of the CryptoKeyVersion. See the state reference for possible outputs.

version Number

Supporting Types

GetKMSCryptoKeyVersionPublicKey

Algorithm string

The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.

Pem string

The public key, encoded in PEM format. For more information, see the RFC 7468 sections for General Considerations and Textual Encoding of Subject Public Key Info.

Algorithm string

The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.

Pem string

The public key, encoded in PEM format. For more information, see the RFC 7468 sections for General Considerations and Textual Encoding of Subject Public Key Info.

algorithm String

The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.

pem String

The public key, encoded in PEM format. For more information, see the RFC 7468 sections for General Considerations and Textual Encoding of Subject Public Key Info.

algorithm string

The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.

pem string

The public key, encoded in PEM format. For more information, see the RFC 7468 sections for General Considerations and Textual Encoding of Subject Public Key Info.

algorithm str

The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.

pem str

The public key, encoded in PEM format. For more information, see the RFC 7468 sections for General Considerations and Textual Encoding of Subject Public Key Info.

algorithm String

The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.

pem String

The public key, encoded in PEM format. For more information, see the RFC 7468 sections for General Considerations and Textual Encoding of Subject Public Key Info.

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.