Skip to content

Add Key Vault ID as a tag to virtual machines and enhance variable descriptions - #85

Merged
lixhunter merged 6 commits into
mainfrom
OE-472-terraform-azurerm-vm-Add-Key-Vault-Resource-ID-as-Tag-to-Virtual-Machine
Aug 19, 2025
Merged

Add Key Vault ID as a tag to virtual machines and enhance variable descriptions#85
lixhunter merged 6 commits into
mainfrom
OE-472-terraform-azurerm-vm-Add-Key-Vault-Resource-ID-as-Tag-to-Virtual-Machine

Conversation

@lixhunter

@lixhunter lixhunter commented Aug 18, 2025

Copy link
Copy Markdown
Contributor

Description

This pull request clarifies and enforces the relationship between the key_vault_id and store_secret_in_key_vault variables, ensures correct tagging behavior for virtual machines, and adds targeted tests for these behaviors. The changes improve both the documentation and the implementation to prevent misconfiguration and make the module's behavior more predictable.

Variable validation and documentation improvements:

  • Added explicit validation to variables.tf to ensure key_vault_id must be set when store_secret_in_key_vault is true and must be null when store_secret_in_key_vault is false. Updated variable descriptions for both key_vault_id and store_secret_in_key_vault for clarity. [1] [2]
  • Updated the README.md to clarify the relationship and requirements between key_vault_id and store_secret_in_key_vault. [1] [2]

Tagging logic enhancements:

  • Refactored tag logic in r-vm.tf to add the key_vault_id as a tag to the virtual machine only when it is set, using a new local.tags_virtual_machine local value. Updated both Linux and Windows VM resources to use this logic. [1] [2] [3]

Testing improvements:

  • Added a new test file input_key_vault_id.tftest.hcl to verify that the key_vault_id tag is only present when expected, and never present when it should not be.
  • Updated existing tests to explicitly set key_vault_id = null when store_secret_in_key_vault = false, ensuring test coverage for the new validation logic. [1] [2] [3]

PR Checklist

  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added documentation written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have checked for a proper tag for this PR: breaking-change, feature, fix, other, ignore-release
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.

Motivation and Context

Breaking Changes

@lixhunter
lixhunter force-pushed the OE-472-terraform-azurerm-vm-Add-Key-Vault-Resource-ID-as-Tag-to-Virtual-Machine branch from e00f917 to 2548ddf Compare August 19, 2025 09:21
…scriptions

Signed-off-by: Andre Licht <al@cloudeteer.de>
@lixhunter
lixhunter force-pushed the OE-472-terraform-azurerm-vm-Add-Key-Vault-Resource-ID-as-Tag-to-Virtual-Machine branch from 2548ddf to 1f469e0 Compare August 19, 2025 09:43
…scriptions

Signed-off-by: Andre Licht <al@cloudeteer.de>
…scriptions

Signed-off-by: Andre Licht <al@cloudeteer.de>
…scriptions

Signed-off-by: Andre Licht <al@cloudeteer.de>
…scriptions

Signed-off-by: Andre Licht <al@cloudeteer.de>
…scriptions

Signed-off-by: Andre Licht <al@cloudeteer.de>

@rswrz rswrz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice work, thanks for implementing this enhancement.

@lixhunter
lixhunter merged commit c440da7 into main Aug 19, 2025
9 checks passed
@lixhunter
lixhunter deleted the OE-472-terraform-azurerm-vm-Add-Key-Vault-Resource-ID-as-Tag-to-Virtual-Machine branch August 19, 2025 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants