gcp.kms.getCryptoKeyLatestVersion
Explore with Pulumi AI
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"])
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
})
}
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 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.applyValue(getKMSKeyRingResult -> getKMSKeyRingResult.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}
Using getCryptoKeyLatestVersion
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 getCryptoKeyLatestVersion(args: GetCryptoKeyLatestVersionArgs, opts?: InvokeOptions): Promise<GetCryptoKeyLatestVersionResult>
function getCryptoKeyLatestVersionOutput(args: GetCryptoKeyLatestVersionOutputArgs, opts?: InvokeOptions): Output<GetCryptoKeyLatestVersionResult>
def get_crypto_key_latest_version(crypto_key: Optional[str] = None,
filter: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetCryptoKeyLatestVersionResult
def get_crypto_key_latest_version_output(crypto_key: Optional[pulumi.Input[str]] = None,
filter: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetCryptoKeyLatestVersionResult]
func GetCryptoKeyLatestVersion(ctx *Context, args *GetCryptoKeyLatestVersionArgs, opts ...InvokeOption) (*GetCryptoKeyLatestVersionResult, error)
func GetCryptoKeyLatestVersionOutput(ctx *Context, args *GetCryptoKeyLatestVersionOutputArgs, opts ...InvokeOption) GetCryptoKeyLatestVersionResultOutput
> Note: This function is named GetCryptoKeyLatestVersion
in the Go SDK.
public static class GetCryptoKeyLatestVersion
{
public static Task<GetCryptoKeyLatestVersionResult> InvokeAsync(GetCryptoKeyLatestVersionArgs args, InvokeOptions? opts = null)
public static Output<GetCryptoKeyLatestVersionResult> Invoke(GetCryptoKeyLatestVersionInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetCryptoKeyLatestVersionResult> getCryptoKeyLatestVersion(GetCryptoKeyLatestVersionArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: gcp:kms/getCryptoKeyLatestVersion:getCryptoKeyLatestVersion
arguments:
# arguments dictionary
The following arguments are supported:
- Crypto
Key string - The
id
of the Google Cloud Platform CryptoKey to which the key version belongs. This is also theid
field of thegcp.kms.CryptoKey
resource/datasource. - Filter string
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".
- Crypto
Key string - The
id
of the Google Cloud Platform CryptoKey to which the key version belongs. This is also theid
field of thegcp.kms.CryptoKey
resource/datasource. - Filter string
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".
- crypto
Key String - The
id
of the Google Cloud Platform CryptoKey to which the key version belongs. This is also theid
field of thegcp.kms.CryptoKey
resource/datasource. - filter String
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".
- crypto
Key string - The
id
of the Google Cloud Platform CryptoKey to which the key version belongs. This is also theid
field of thegcp.kms.CryptoKey
resource/datasource. - filter string
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".
- crypto_
key str - The
id
of the Google Cloud Platform CryptoKey to which the key version belongs. This is also theid
field of thegcp.kms.CryptoKey
resource/datasource. - filter str
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".
- crypto
Key String - The
id
of the Google Cloud Platform CryptoKey to which the key version belongs. This is also theid
field of thegcp.kms.CryptoKey
resource/datasource. - filter String
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".
getCryptoKeyLatestVersion Result
The following output properties are available:
- Algorithm string
- The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.
- Crypto
Key string - Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Protection
Level string - The ProtectionLevel describing how crypto operations are performed with this CryptoKeyVersion. See the protection_level reference for possible outputs.
- Public
Keys List<GetCrypto Key Latest Version Public Key> - If the enclosing CryptoKey has purpose
ASYMMETRIC_SIGN
orASYMMETRIC_DECRYPT
, this block contains details about the public key associated to this CryptoKeyVersion. Structure is documented below. - State string
- The current state of the latest CryptoKeyVersion. See the state reference for possible outputs.
- Version int
- Filter string
- Algorithm string
- The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.
- Crypto
Key string - Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Protection
Level string - The ProtectionLevel describing how crypto operations are performed with this CryptoKeyVersion. See the protection_level reference for possible outputs.
- Public
Keys []GetCrypto Key Latest Version Public Key - If the enclosing CryptoKey has purpose
ASYMMETRIC_SIGN
orASYMMETRIC_DECRYPT
, this block contains details about the public key associated to this CryptoKeyVersion. Structure is documented below. - State string
- The current state of the latest CryptoKeyVersion. See the state reference for possible outputs.
- Version int
- Filter string
- algorithm String
- The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.
- crypto
Key String - id String
- The provider-assigned unique ID for this managed resource.
- name String
- protection
Level String - The ProtectionLevel describing how crypto operations are performed with this CryptoKeyVersion. See the protection_level reference for possible outputs.
- public
Keys List<GetCrypto Key Latest Version Public Key> - If the enclosing CryptoKey has purpose
ASYMMETRIC_SIGN
orASYMMETRIC_DECRYPT
, this block contains details about the public key associated to this CryptoKeyVersion. Structure is documented below. - state String
- The current state of the latest CryptoKeyVersion. See the state reference for possible outputs.
- version Integer
- filter String
- algorithm string
- The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.
- crypto
Key string - id string
- The provider-assigned unique ID for this managed resource.
- name string
- protection
Level string - The ProtectionLevel describing how crypto operations are performed with this CryptoKeyVersion. See the protection_level reference for possible outputs.
- public
Keys GetCrypto Key Latest Version Public Key[] - If the enclosing CryptoKey has purpose
ASYMMETRIC_SIGN
orASYMMETRIC_DECRYPT
, this block contains details about the public key associated to this CryptoKeyVersion. Structure is documented below. - state string
- The current state of the latest CryptoKeyVersion. See the state reference for possible outputs.
- version number
- filter string
- algorithm str
- The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.
- crypto_
key str - id str
- The provider-assigned unique ID for this managed resource.
- name str
- 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[GetCrypto Key Latest Version Public Key] - If the enclosing CryptoKey has purpose
ASYMMETRIC_SIGN
orASYMMETRIC_DECRYPT
, this block contains details about the public key associated to this CryptoKeyVersion. Structure is documented below. - state str
- The current state of the latest CryptoKeyVersion. See the state reference for possible outputs.
- version int
- filter str
- algorithm String
- The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports.
- crypto
Key String - id String
- The provider-assigned unique ID for this managed resource.
- name String
- protection
Level String - The ProtectionLevel describing how crypto operations are performed with this CryptoKeyVersion. See the protection_level reference for possible outputs.
- public
Keys List<Property Map> - If the enclosing CryptoKey has purpose
ASYMMETRIC_SIGN
orASYMMETRIC_DECRYPT
, this block contains details about the public key associated to this CryptoKeyVersion. Structure is documented below. - state String
- The current state of the latest CryptoKeyVersion. See the state reference for possible outputs.
- version Number
- filter String
Supporting Types
GetCryptoKeyLatestVersionPublicKey
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.