Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Source: azurerm_recovery_services_protection_policy_vm #3063

Closed
mariuszdotnet opened this issue Mar 17, 2019 · 3 comments · Fixed by #3108
Closed

Data Source: azurerm_recovery_services_protection_policy_vm #3063

mariuszdotnet opened this issue Mar 17, 2019 · 3 comments · Fixed by #3108

Comments

@mariuszdotnet
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureRM Provider) Version

Terraform v0.11.13

  • provider.azurerm v1.23.0
  • provider.random v2.0.0

Affected Resource(s)

Data Source: azurerm_recovery_services_protection_policy_vm

Debug Output

Error: Error running plan: 1 error(s) occurred:

  • 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"

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:

  • 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"

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)}"

  • #0000
@mcharriere
Copy link
Contributor

I've found that this is a know issue in the azure SDK
I'm adding a workaround as in the azurerm_recovery_service_protection_policy_vm resource.

@ghost
Copy link

ghost commented Apr 3, 2019

This has been released in version 1.24.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
	version = "~> 1.24.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Apr 25, 2019

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!

@hashicorp hashicorp locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants