get Crypto Key Versions
Provides access to Google Cloud Platform KMS CryptoKeyVersions. 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 myCryptoKeyVersions = gcp.kms.getCryptoKeyVersions({
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_versions = gcp.kms.get_crypto_key_versions(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 myCryptoKeyVersions = Gcp.Kms.GetCryptoKeyVersions.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.GetCryptoKeyVersions(ctx, &kms.GetCryptoKeyVersionsArgs{
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.GetCryptoKeyVersionsArgs;
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 myCryptoKeyVersions = KmsFunctions.getCryptoKeyVersions(GetCryptoKeyVersionsArgs.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}
myCryptoKeyVersions:
fn::invoke:
function: gcp:kms:getCryptoKeyVersions
arguments:
cryptoKey: ${myKey.id}
Return
A collection of values returned by getCryptoKeyVersions.
Parameters
A collection of arguments for invoking getCryptoKeyVersions.
Return
A collection of values returned by getCryptoKeyVersions.
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 versions are retrieved by the data source: ?filter={{filter}}. When no value is provided there is no filtering. Example filter values if filtering on name. Note: names take the form projects/{{project}}/locations/{{location}}/keyRings/{{keyRing}}/cryptoKeys/{{cryptoKey}}/cryptoKeyVersions.
"name:my-key-"
will retrieve cryptoKeyVersions that contain "my-key-" anywhere in their name."name=projects/my-project/locations/global/keyRings/my-key-ring/cryptoKeys/my-key-1/cryptoKeyVersions/my-version-1"
will only retrieve a key with that exact name. See the documentation about using filters
See also
Return
A collection of values returned by getCryptoKeyVersions.
Parameters
Builder for com.pulumi.gcp.kms.kotlin.inputs.GetCryptoKeyVersionsPlainArgs.