get Crypto Key Latest Version
Provides access to the latest Google Cloud Platform KMS CryptoKeyVersion in a CryptoKey. For more information see the official documentation and API.
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 myCryptoKeyLatestVersion = gcp.kms.getCryptoKeyLatestVersion({
cryptoKey: myKey.id,
});
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_latest_version = gcp.kms.get_crypto_key_latest_version(crypto_key=my_key["id"])
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 myCryptoKeyLatestVersion = Gcp.Kms.GetCryptoKeyLatestVersion.Invoke(new()
{
CryptoKey = myKey.Id,
});
});
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 {
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.GetCryptoKeyLatestVersion(ctx, &kms.GetCryptoKeyLatestVersionArgs{
CryptoKey: myKey.Id,
}, nil)
if err != nil {
return err
}
return nil
})
}
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.GetCryptoKeyLatestVersionArgs;
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.id())
.build());
final var myCryptoKeyLatestVersion = KmsFunctions.getCryptoKeyLatestVersion(GetCryptoKeyLatestVersionArgs.builder()
.cryptoKey(myKey.id())
.build());
}
}
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}
myCryptoKeyLatestVersion:
fn::invoke:
function: gcp:kms:getCryptoKeyLatestVersion
arguments:
cryptoKey: ${myKey.id}
Return
A collection of values returned by getCryptoKeyLatestVersion.
Parameters
A collection of arguments for invoking getCryptoKeyLatestVersion.
Return
A collection of values returned by getCryptoKeyLatestVersion.
Parameters
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.
The filter argument is used to add a filter query parameter that limits which type of cryptoKeyVersion is retrieved as the latest by the data source: ?filter={{filter}}. When no value is provided there is no filtering. Example filter values if filtering on state.
"state:ENABLED"
will retrieve the latest cryptoKeyVersion that has the state "ENABLED". See the documentation about using filters
See also
Return
A collection of values returned by getCryptoKeyLatestVersion.
Parameters
Builder for com.pulumi.gcp.kms.kotlin.inputs.GetCryptoKeyLatestVersionPlainArgs.