azurerm_key_vault: fix enabling "purge_protection_enabledissue" does not work issue #16368
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix issue #16289.
When the KV was created with a version prior to v2.42 and the
soft_delete_enabled
is set to false, settingpurge_protection_enabled
totrue
would not work when updating KV with v2.42 or later of terraform provider. This is because thepurge_protection_enabled
only works when soft delete is enabled. Since version v2.42 of the Azure Provider and later force the value ofsoft_delete_enabled
to be true, we should setEnableSoftDelete
to true in funcresourceKeyVaultUpdate
whenpurge_protection_enabled
is enabled.