Skip to content

fix: default disk encryption key type to RSA - #25

Merged
dverma-cd merged 1 commit into
terraform-az-modules:masterfrom
dverma-cd:fix/default-standard-key-vault-key-type
May 7, 2026
Merged

fix: default disk encryption key type to RSA#25
dverma-cd merged 1 commit into
terraform-az-modules:masterfrom
dverma-cd:fix/default-standard-key-vault-key-type

Conversation

@dverma-cd

Copy link
Copy Markdown
Contributor

Summary

  • change the default from to
  • document that HSM key types require a premium or HSM-capable Key Vault
  • update the tracked inputs documentation

Why

The current module default creates an HSM-backed key when . That fails against a standard Key Vault with . Defaulting to keeps the module compatible with standard Key Vault deployments while still allowing callers to opt into explicitly when they use a premium vault.

Validation

@dverma-cd
dverma-cd requested a review from a team as a code owner May 7, 2026 10:17

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request changes the default key_type from RSA-HSM to RSA and updates the documentation to clarify that HSM key types require a premium or HSM-capable Key Vault. The review feedback suggests adding a validation block to the key_type variable and removing references to EC and EC-HSM from the descriptions, as the current implementation only supports RSA types.

Comment thread variables.tf
Comment on lines +614 to +615
default = "RSA"
description = "The Key Type for Key Vault. Possible values: EC, EC-HSM, RSA, RSA-HSM. Use an HSM key type only with a premium or HSM-capable Key Vault."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While changing the default to RSA improves compatibility with standard Key Vaults, there are two improvement opportunities:

  1. Validation: Adding a validation block ensures that only valid values are provided, preventing late-stage deployment failures.
  2. EC Support Discrepancy: The description lists EC and EC-HSM as possible values, but the module's implementation in main.tf (lines 101-109) does not currently support them (it lacks the required curve parameter and unconditionally passes key_size). It is recommended to remove these from the description until support is implemented.
  default     = "RSA"
  description = "The Key Type for Key Vault. Possible values: RSA, RSA-HSM. Use an HSM key type only with a premium or HSM-capable Key Vault."

  validation {
    condition     = contains(["RSA", "RSA-HSM"], var.key_type)
    error_message = "The key_type must be one of: RSA, RSA-HSM."
  }

Comment thread docs/io.md
| key\_permissions | List of Key Vault key permissions | `list(string)` | <pre>[<br> "Create",<br> "Delete",<br> "Get",<br> "Purge",<br> "Recover",<br> "Update",<br> "WrapKey",<br> "UnwrapKey",<br> "List",<br> "Decrypt",<br> "Sign"<br>]</pre> | no |
| key\_size | Size of the RSA key in bytes (e.g., 1024, 2048). | `number` | `2048` | no |
| key\_type | The Key Type for Key Vault. Possible values: EC, EC-HSM, RSA, RSA-HSM. | `string` | `"RSA-HSM"` | no |
| key\_type | The Key Type for Key Vault. Possible values: EC, EC-HSM, RSA, RSA-HSM. Use an HSM key type only with a premium or HSM-capable Key Vault. | `string` | `"RSA"` | no |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The description lists EC and EC-HSM as possible values, but the module's implementation currently only supports RSA types. Consider removing them to accurately reflect the module's capabilities.

Suggested change
| key\_type | The Key Type for Key Vault. Possible values: EC, EC-HSM, RSA, RSA-HSM. Use an HSM key type only with a premium or HSM-capable Key Vault. | `string` | `"RSA"` | no |
| key\_type | The Key Type for Key Vault. Possible values: RSA, RSA-HSM. Use an HSM key type only with a premium or HSM-capable Key Vault. | `string` | `"RSA"` | no |

@dverma-cd
dverma-cd merged commit 338d666 into terraform-az-modules:master May 7, 2026
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant