get KMSCrypto Key Version
suspend fun getKMSCryptoKeyVersion(argument: GetKMSCryptoKeyVersionPlainArgs): GetKMSCryptoKeyVersionResult
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
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: myKey.id,
});
Content copied to clipboard
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=my_key["id"])
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var myKeyRing = Gcp.Kms.GetKMSKeyRing.Invoke(new()
{
Name = "my-key-ring",
Location = "us-central1",
});
var myCryptoKey = Gcp.Kms.GetKMSCryptoKey.Invoke(new()
{
Name = "my-crypto-key",
KeyRing = myKeyRing.Apply(getKMSKeyRingResult => getKMSKeyRingResult.Id),
});
var myCryptoKeyVersion = Gcp.Kms.GetKMSCryptoKeyVersion.Invoke(new()
{
CryptoKey = myKey.Id,
});
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/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: myKey.Id,
}, nil)
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
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.GetKMSKeyRingArgs;
import com.pulumi.gcp.kms.inputs.GetKMSCryptoKeyArgs;
import com.pulumi.gcp.kms.inputs.GetKMSCryptoKeyVersionArgs;
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 myKeyRing = KmsFunctions.getKMSKeyRing(GetKMSKeyRingArgs.builder()
.name("my-key-ring")
.location("us-central1")
.build());
final var myCryptoKey = KmsFunctions.getKMSCryptoKey(GetKMSCryptoKeyArgs.builder()
.name("my-crypto-key")
.keyRing(myKeyRing.applyValue(getKMSKeyRingResult -> getKMSKeyRingResult.id()))
.build());
final var myCryptoKeyVersion = KmsFunctions.getKMSCryptoKeyVersion(GetKMSCryptoKeyVersionArgs.builder()
.cryptoKey(myKey.id())
.build());
}
}
Content copied to clipboard
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: ${myKey.id}
Content copied to clipboard
Return
A collection of values returned by getKMSCryptoKeyVersion.
Parameters
argument
A collection of arguments for invoking getKMSCryptoKeyVersion.
suspend fun getKMSCryptoKeyVersion(cryptoKey: String, version: Int? = null): GetKMSCryptoKeyVersionResult
Return
A collection of values returned by getKMSCryptoKeyVersion.
Parameters
crypto Key
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
The version number for this CryptoKeyVersion. Defaults to 1
.
See also
suspend fun getKMSCryptoKeyVersion(argument: suspend GetKMSCryptoKeyVersionPlainArgsBuilder.() -> Unit): GetKMSCryptoKeyVersionResult
Return
A collection of values returned by getKMSCryptoKeyVersion.
Parameters
argument
Builder for com.pulumi.gcp.kms.kotlin.inputs.GetKMSCryptoKeyVersionPlainArgs.