gpt4 book ai didi

azure - Terraform Azurerm 恢复服务保管库备份策略格式错误

转载 作者:行者123 更新时间:2023-12-03 02:51:05 31 4
gpt4 key购买 nike

我正在尝试在 Terraform 中创建每周 Azure VM 保护策略,在周五下午 6:30 运行,保留期为 1。TF 抛出与格式错误相关的错误“计划时间、计划天数、保留时间和保留天数”错误。我不确定哪个参数的值或格式不正确。

resource "azurerm_recovery_services_vault" "backup_vault" {
name = "${var.RG4VM}-recovery-vault"
location = "${var.VMLocation}"
resource_group_name = "${var.RG4VM}"
sku = "Standard"
depends_on = ["azurerm_resource_group.ResourceGroup"]
}

resource "azurerm_recovery_services_protection_policy_vm" "backup_policy" {
name = "${var.RG4VM}-bkp-policy"
resource_group_name = "${var.RG4VM}"
recovery_vault_name = "${azurerm_recovery_services_vault.backup_vault.name}"
depends_on = ["azurerm_recovery_services_vault.backup_vault"]

backup {
frequency = "Weekly"
time = "18:30"
}

retention_weekly {
count = 1
weekdays = ["Friday"]
}
}

预计:它应该根据定义的配置创建策略。

实际:

  • azurerm_recovery_services_protection_policy_vm.backup_policy: 1 error(s) occurred:

  • azurerm_recovery_services_protection_policy_vm.backup_policy: Error creating/updating Recovery Service Protection Policy "Terraform-Linux-Test-RG-bkp-policy" (Resource Group "Terraform-Linux-Test-RG"): backup.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\r\nPlease check format of parameters like schedule time, schedule days, retention time and retention days "

如果您能帮助解决此问题,我将不胜感激。

谢谢阿斯加尔

最佳答案

对于你的问题,也许是你犯了一个小错误。您只需在策略的备份 block 中进行如下更改:

backup {
frequency = "Weekly"
time = "18:30"
weekdays = ["Friday"]
}

然后就可以正常工作了。我这边测试的截图如下:

enter image description here

关于azure - Terraform Azurerm 恢复服务保管库备份策略格式错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56083863/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com