output "key_id" { description = "The key. Give this OCID to the services that should encrypt with it." value = oci_kms_key.this.id } output "crypto_endpoint" { description = "Where encrypt and decrypt calls go." value = oci_kms_vault.this.crypto_endpoint } output "enabled" { description = "Whether the key is switched on." value = var.enabled } output "verify" { description = "Encrypt, switch the key off, watch decrypt fail, switch it back on. Run as a key administrator." value = <<-EOT oci kms crypto encrypt --key-id ${oci_kms_key.this.id} --endpoint ${oci_kms_vault.this.crypto_endpoint} --plaintext "$(printf hello | base64)" --query 'data.ciphertext' --raw-output > secret.txt oci kms management key disable --key-id ${oci_kms_key.this.id} --endpoint ${oci_kms_vault.this.management_endpoint} oci kms crypto decrypt --key-id ${oci_kms_key.this.id} --endpoint ${oci_kms_vault.this.crypto_endpoint} --ciphertext "$(cat secret.txt)" # must fail, the key is disabled oci kms management key enable --key-id ${oci_kms_key.this.id} --endpoint ${oci_kms_vault.this.management_endpoint} EOT }