Files

2.1 KiB

page_title, subcategory, description
page_title subcategory description
kms_kms_key_public_key Data Source - terraform-provider KMS Retrieve the public key and signing algorithms for a KMS key. This data source is specifically designed for getting public keys for cryptographic operations.

kms_kms_key_public_key (Data Source)

Retrieve the public key and signing algorithms for a KMS key. This data source is specifically designed for getting public keys for cryptographic operations.

Example Usage

terraform {
  required_providers {
    kms = {
      # version = <latest version>
      source = "hanzokms/kms"
    }
  }
}

provider "kms" {
  host = "https://kms.hanzo.ai" # Only required if using self hosted instance of Hanzo KMS, default is https://kms.hanzo.ai
  auth = {
    universal = {
      client_id     = "<machine-identity-client-id>"
      client_secret = "<machine-identity-client-secret>"
    }
  }
}

# Get public key information for a signing KMS key
data "kms_kms_key_public_key" "example" {
  key_id = "<your-signing-kms-key-id>"
}

# Output the public key
output "public_key" {
  value       = data.kms_kms_key_public_key.example.public_key
  description = "The public key for cryptographic operations"
}

# Output available signing algorithms
output "signing_algorithms" {
  value       = data.kms_kms_key_public_key.example.signing_algorithms
  description = "Available signing algorithms for this key"
}

Schema

Required

  • key_id (String) The ID of the KMS key to retrieve the public key for.

Read-Only

  • encryption_algorithm (String) The encryption algorithm used by the key.
  • key_usage (String) The usage of the key ('encrypt-decrypt' or 'sign-verify').
  • name (String) The name of the KMS key.
  • public_key (String) The public key. Only available for signing keys (key_usage = 'sign-verify').
  • signing_algorithms (List of String) List of available signing algorithms. Only available for signing keys (key_usage = 'sign-verify').