Open slzmruepp opened 1 year ago
Thanks for raising this issue. Seems I cannot repro this issue. Could you re-try with below tf config that is similar with yours to see if the issue still exists? Thanks.
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctest-dataprotection-test01"
location = "west europe"
}
resource "azurerm_storage_account" "test" {
name = "acctestsatest01"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
account_tier = "Standard"
account_replication_type = "LRS"
}
resource "azurerm_data_protection_backup_vault" "test" {
name = "acctest-dataprotection-vault-test01"
resource_group_name = azurerm_resource_group.test.name
location = azurerm_resource_group.test.location
datastore_type = "VaultStore"
redundancy = "LocallyRedundant"
identity {
type = "SystemAssigned"
}
}
resource "azurerm_role_assignment" "test" {
scope = azurerm_storage_account.test.id
role_definition_name = "Storage Account Backup Contributor"
principal_id = azurerm_data_protection_backup_vault.test.identity[0].principal_id
}
resource "azurerm_data_protection_backup_policy_blob_storage" "test" {
name = "acctest-dbp-test01"
vault_id = azurerm_data_protection_backup_vault.test.id
retention_duration = "P30D"
}
resource "azurerm_data_protection_backup_policy_blob_storage" "another" {
name = "acctest-dbp-other-test01"
vault_id = azurerm_data_protection_backup_vault.test.id
retention_duration = "P15D"
}
resource "azurerm_data_protection_backup_instance_blob_storage" "test" {
name = "acctest-dbi-test01"
location = azurerm_resource_group.test.location
vault_id = azurerm_data_protection_backup_vault.test.id
storage_account_id = azurerm_storage_account.test.id
backup_policy_id = azurerm_data_protection_backup_policy_blob_storage.test.id
depends_on = [azurerm_role_assignment.test]
}
similar issue is happening for azurerm_data_protection_backup_policy_disk as well when modified after creation.
Error: deleting DataProtection BackupPolicy ("Backup Policy (")"): unexpected status 400 with error: UserErrorDppPolicyObjectInUse: Cannot delete the backup policy as one or more backup instances have been configured for protection with this policy.
Is there an existing issue for this?
Community Note
Terraform Version
1.3.7
AzureRM Provider Version
3.45.0
Affected Resource(s)/Data Source(s)
azurerm_data_protection_backup_policy_blob_storage
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
Its expected that Terraform recognizes the dependencies of azurerm_data_protection_backup_policy_blob_storage and azurerm_data_protection_backup_instance_blob_storage
So if a policy is used by a backup instance, and changed, it should trigger the recreation of the instance as well. Otherwise apply fails every time.
Actual Behaviour
The apply run does not recreate the instance only the policy and fails all the time because of the interdependency.
Steps to Reproduce
Create a storage account, backup vault, backup policy and instance. Try to change the backup policy parameter
retention_duration = "P30D"
to (example)retention_duration = "P15D"
Important Factoids
No response
References
No response