azurerm_key_vault
- fix two kv in different sub issue
#19531
Merged
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.
resolves #19509
background
Assume we have
azurerm_key_vault_secret
orazurerm_storage_account
) in subscription1 depends on the kv2the config is like:
Replace two real subscription ids the above config, and run
terraform apply -auto-approve
twice.During the refresh step before the second apply,
data.azurerm_key_vault_secret.test
calls theBaseUriForKeyVault
function, which will modify the subscription_id of KeyVaultsClient within the provider scope. After that the KeyVaultsClient cannot reachazurerm_key_vault.kv1
, and theazurerm_key_vault.kv1
will be removed from state.But later apply will try to recreate the kv1 in another thread in sub1, returns the resource already exists error.