You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
azurerm_recovery_services_protected_vm.vmstamp: Can not parse "backup_policy_id" as a resource id: No subscription ID found in: "Subscriptions/5aec60e9-f535-4bd7-a951-2833f043e918/resourceGroups/backup-vault-rg/providers/Microsoft.RecoveryServices/vaults/mk-vm-vault/backupPolicies/DefaultPolicy"
azurerm_recovery_services_protected_vm.vmstamp: Can not parse "backup_policy_id" as a resource id: No subscription ID found in: "Subscriptions/5aec60e9-f535-4bd7-a951-2833f043e918/resourceGroups/backup-vault-rg/providers/Microsoft.RecoveryServices/vaults/mk-vm-vault/backupPolicies/DefaultPolicy"
Steps to Reproduce
define data reference for existing resource:
data "azurerm_recovery_services_protection_policy_vm" "vmstamp" {
name = "DefaultPolicy"
recovery_vault_name = "mk-vm-vault"
resource_group_name = "backup-vault-rg"
}
try to reference its ID in resource "azurerm_recovery_services_protected_vm"
Hardcoding the backup_policy_id to the resource works. Note the subscription Key/Value starts with a lower S, where as the error returns it with a capital S.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!
Community Note
Terraform (and AzureRM Provider) Version
Terraform v0.11.13
Affected Resource(s)
Data Source: azurerm_recovery_services_protection_policy_vm
Debug Output
Error: Error running plan: 1 error(s) occurred:
Expected Behavior
backup_policy_id = "${data.azurerm_recovery_services_protection_policy_vm.vmstamp.id}"
should return the resource id of the policy.
"subscriptions/5aec60e9-f535-4bd7-a951-2833f043e918/resourceGroups/backup-vault-rg/providers/Microsoft.RecoveryServices/vaults/mk-vm-vault/backupPolicies/DefaultPolicy"
Actual Behavior
I get this error
Error: Error running plan: 1 error(s) occurred:
Steps to Reproduce
define data reference for existing resource:
data "azurerm_recovery_services_protection_policy_vm" "vmstamp" {
name = "DefaultPolicy"
recovery_vault_name = "mk-vm-vault"
resource_group_name = "backup-vault-rg"
}
try to reference its ID in resource "azurerm_recovery_services_protected_vm"
resource "azurerm_recovery_services_protected_vm" "vmstamp" {
resource_group_name = "${data.azurerm_recovery_services_protection_policy_vm.vmstamp.resource_group_name}"
recovery_vault_name = "${data.azurerm_recovery_services_protection_policy_vm.vmstamp.recovery_vault_name}"
backup_policy_id = "${data.azurerm_recovery_services_protection_policy_vm.vmstamp.id}"
source_vm_id = "/subscriptions/5aec60e9-f535-4bd7-a951-2833f043e918/resourceGroups/sql-server-rg/providers/Microsoft.Compute/virtualMachines/testsqlserver"
}
terraform plan
Important Factoids
Hardcoding the backup_policy_id to the resource works. Note the subscription Key/Value starts with a lower S, where as the error returns it with a capital S.
backup_policy_id = "/subscriptions/5aec60e9-f535-4bd7-a951-2833f043e918/resourceGroups/backup-vault-rg/providers/Microsoft.RecoveryServices/vaults/mk-vm-vault/backupPolicies/DefaultPolicy"
another way to confirm this is to put lower() function around the id from the data source and it works fine.
backup_policy_id = "${lower(data.azurerm_recovery_services_protection_policy_vm.vmstamp.id)}"
The text was updated successfully, but these errors were encountered: