Closed Greysi87 closed 1 month ago
Unfortunately this bug has not been solved. Tested with azurerm 4.4.0 and tried to change backup time from 02:00 to 02:30 and got error:
~ resource "azurerm_backup_policy_vm" "vm-gold-v2" { id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-qua-chn-services-mgmt/providers/Microsoft.RecoveryServices/vaults/rsv-chn-services/backupPolicies/vm-gold-v2" name = "vm-gold-v2"
~ backup {
~ time = "02:00" -> "02:30"
# (4 unchanged attributes hidden)
}
# (4 unchanged blocks hidden)
}
Error: updating Backup Policy (Subscription: "00000000-0000-0000-0000-000000000000" │ Resource Group Name: "rg-qua-chn-services-mgmt" │ Vault Name: "rsv-chn-services" │ Backup Policy Name: "vm-gold-v2"): protectionpolicies.ProtectionPoliciesClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BMSUserErrorInvalidPolicyInput" Message="Input for create or update policy is not in proper format. Please check format of parameters like schedule time, schedule days, retention time and retention days " │ │ with module.recovery_services_vault.azurerm_backup_policy_vm.vm-gold-v2, │ on policy_vm.tf line 172, in resource "azurerm_backup_policy_vm" "vm-gold-v2": │ 172: resource "azurerm_backup_policy_vm" "vm-gold-v2" { │
I found, issue exists only, if an azurerm_backup_policy_vm contains a retention_monthly config. If a backup policy will be created without a monthly retention, all works fine.
It also works, if you remove monthly retention, change backup time and recreate monthly retention.
Conclusion: As soon as retention policy has a monthly retention, modifying backup time is not possible and you get above error.
Is there an existing issue for this?
Community Note
Terraform Version
1.9
AzureRM Provider Version
3.116.0
Affected Resource(s)/Data Source(s)
azurerm_backup_policy_vm
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
Backup time can be changed the same ways, as it can be set/created.
Actual Behaviour
If backup time should be changed, an error appears:
╷ │ Error: updating Backup Policy (Subscription: "00000000-0000-0000-0000-000000000000" │ Resource Group Name: "rg-qua-chn-services-mgmt" │ Vault Name: "rsv-chn-services" │ Backup Policy Name: "vm-gold-v2"): protectionpolicies.ProtectionPoliciesClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BMSUserErrorInvalidPolicyInput" Message="Input for create or update policy is not in proper format. Please check format of parameters like schedule time, schedule days, retention time and retention days " │ │ with azurerm_backup_policy_vm.vm-gold-v2, │ on policy_vm.tf line 172, in resource "azurerm_backup_policy_vm" "vm-gold-v2": │ 172: resource "azurerm_backup_policy_vm" "vm-gold-v2" { │ ╵
Initial creating backup policy for VMs works fine, only changes are affected.
Steps to Reproduce
Important Factoids
No response
References
This issue exists in azurerm version 3.112.0 to 4.2.0 (tested). probably also in previous versions (not tested).