|
| 1 | +--- |
| 2 | +subcategory: "Cloud Key Management Service" |
| 3 | +description: |- |
| 4 | + Provides access to the latest KMS key version data with Google Cloud KMS. |
| 5 | +--- |
| 6 | + |
| 7 | +# google_kms_crypto_key_version_latest |
| 8 | + |
| 9 | +Provides access to a Google Cloud Platform KMS Latest CryptoKeyVersion. For more information see |
| 10 | +[the official documentation](https://cloud.google.com/kms/docs/object-hierarchy#key_version) |
| 11 | +and |
| 12 | +[API](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions). |
| 13 | + |
| 14 | +A CryptoKeyVersion represents an individual cryptographic key, and the associated key material. Multiple CryptoKeyVersions can |
| 15 | +exist within one CryptoKey. This data source allows the ability to use the latest CryptoVersion from a specified CryptoKey. |
| 16 | + |
| 17 | +## Example Usage |
| 18 | + |
| 19 | +```hcl |
| 20 | +data "google_kms_key_ring" "my_key_ring" { |
| 21 | + name = "my-key-ring" |
| 22 | + location = "us-central1" |
| 23 | +} |
| 24 | +
|
| 25 | +data "google_kms_crypto_key" "my_crypto_key" { |
| 26 | + name = "my-crypto-key" |
| 27 | + key_ring = data.google_kms_key_ring.my_key_ring.id |
| 28 | +} |
| 29 | +
|
| 30 | +data "google_kms_crypto_key_version_latest" "my_crypto_key_version_latest" { |
| 31 | + crypto_key = data.google_kms_crypto_key.my_key.id |
| 32 | +} |
| 33 | +``` |
| 34 | + |
| 35 | +## Argument Reference |
| 36 | + |
| 37 | +The following arguments are supported: |
| 38 | + |
| 39 | +* `crypto_key` - (Required) The `id` of the Google Cloud Platform CryptoKey to which the key version belongs. This is also the `id` field of the |
| 40 | +`google_kms_crypto_key` resource/datasource. |
| 41 | + |
| 42 | +## Attributes Reference |
| 43 | + |
| 44 | +In addition to the arguments listed above, the following computed attributes are |
| 45 | +exported: |
| 46 | + |
| 47 | +* `id` - an identifier for the resource with format `//cloudkms.googleapis.com/v1/{{crypto_key}}/cryptoKeyVersions/{{version}}` |
| 48 | + |
| 49 | +* `name` - The resource name for this CryptoKeyVersion in the format `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*` |
| 50 | + |
| 51 | +* `state` - The current state of the CryptoKeyVersion. See the [state reference](https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys.cryptoKeyVersions#CryptoKeyVersion.CryptoKeyVersionState) for possible outputs. |
| 52 | + |
| 53 | +* `protection_level` - The ProtectionLevel describing how crypto operations are performed with this CryptoKeyVersion. See the [protection_level reference](https://cloud.google.com/kms/docs/reference/rest/v1/ProtectionLevel) for possible outputs. |
| 54 | + |
| 55 | +* `algorithm` - The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports. See the [algorithm reference](https://cloud.google.com/kms/docs/reference/rest/v1/CryptoKeyVersionAlgorithm) for possible outputs. |
| 56 | + |
| 57 | +* `public_key` - 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](#nested_public_key). |
| 58 | + |
| 59 | +<a name="nested_public_key"></a>The `public_key` block, if present, contains: |
| 60 | + |
| 61 | +* `pem` - 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. |
| 62 | + |
| 63 | +* `algorithm` - The CryptoKeyVersionAlgorithm that this CryptoKeyVersion supports. |
| 64 | + |
| 65 | + |
0 commit comments