Review the Cloud KMS key rotation period

Rotate keys according to policy and plan how to handle earlier versions and data.

Description

Automatic rotation creates a new primary version of a symmetric Cloud KMS encryption key. The longer you use one version, the more data may depend on it.

Potential impact

If a version is compromised, data encrypted with it can be affected. Rotation leaves existing ciphertext dependent on its earlier version.

Remediation

Set rotation_period to your policy’s interval. Use 7776000s for 90 days. Plan asymmetric key replacement separately. If a key is compromised, restrict access and assess decryption and recovery requirements before re-encrypting data or disabling the affected version.

Examples

The examples shorten the same key’s interval from about 900 days (77760009s) to about 28 hours (100000s). Both are comparison values. The key ring and prevent_destroy setting are unchanged.

Before

hcl
resource "google_kms_crypto_key" "crypto_key" {
  name            = "crypto-key-example"
  key_ring        = google_kms_key_ring.keyring.id
  rotation_period = "77760009s"

  lifecycle {
    prevent_destroy = true
  }
}

After

hcl
resource "google_kms_crypto_key" "crypto_key" {
  name            = "crypto-key-example"
  key_ring        = google_kms_key_ring.keyring.id
  rotation_period = "100000s"

  lifecycle {
    prevent_destroy = true
  }
}

References