diff --git a/azurerm/resource_arm_recovery_services_protected_vm.go b/azurerm/resource_arm_recovery_services_protected_vm.go index 47ec96ab491d..fc6976141660 100644 --- a/azurerm/resource_arm_recovery_services_protected_vm.go +++ b/azurerm/resource_arm_recovery_services_protected_vm.go @@ -51,7 +51,7 @@ func resourceArmRecoveryServicesProtectedVm() *schema.Resource { "backup_policy_id": { Type: schema.TypeString, - Optional: true, + Required: true, ForceNew: true, ValidateFunc: azure.ValidateResourceID, }, diff --git a/website/docs/r/recovery_services_protected_vm.markdown b/website/docs/r/recovery_services_protected_vm.markdown index 65a14d97f055..44699e6f74a0 100644 --- a/website/docs/r/recovery_services_protected_vm.markdown +++ b/website/docs/r/recovery_services_protected_vm.markdown @@ -26,13 +26,23 @@ resource "azurerm_recovery_services_vault" "example" { sku = "Standard" } +resource "azurerm_recovery_services_protection_policy_vm" "test" { + name = "acctest-%d" + resource_group_name = "${azurerm_resource_group.test.name}" + recovery_vault_name = "${azurerm_recovery_services_vault.test.name}" + + backup = { + frequency = "Daily" + time = "23:00" + } +} + resource "azurerm_recovery_services_protected_vm" "example" { location = "${azurerm_resource_group.example.location}" resource_group_name = "${azurerm_resource_group.example.name}" recovery_vault_name = "${azurerm_recovery_services_vault.example.name}" - source_vm_name = "${azurerm_virtual_machine.example.name}" source_vm_id = "${azurerm_virtual_machine.example.id}" - backup_policy_name = "aBackupPolicy" + backup_policy_id = "${azurerm_recovery_services_protection_policy_vm.example.id}" } ``` @@ -47,11 +57,9 @@ The following arguments are supported: * `recovery_vault_name` - (Required) Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created. -* `source_vm_name` - (Required) Specifies the name of the VM to backup. Changing this forces a new resource to be created. - * `source_vm_id` - (Required) Specifies the ID of the VM to backup. Changing this forces a new resource to be created. -* `backup_policy_name` - (Optional) Specifies the name of the backup policy to use. Defaults to `DefaultPolicy` Changing this forces a new resource to be created. +* `backup_policy_id` - (Required) Specifies the id of the backup policy to use. Changing this forces a new resource to be created. * `tags` - (Optional) A mapping of tags to assign to the resource.