Skip to content

Commit

Permalink
Minor cleanup to protected VM code
Browse files Browse the repository at this point in the history
  • Loading branch information
katbyte committed Jul 24, 2018
1 parent ab93a80 commit a5af4ca
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 10 deletions.
8 changes: 0 additions & 8 deletions azurerm/resource_arm_recovery_services_protected_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ func resourceArmRecoveryServicesProtectedVm() *schema.Resource {

Schema: map[string]*schema.Schema{

// "location": locationSchema(),

"resource_group_name": resourceGroupNameSchema(),

"recovery_vault_name": {
Expand Down Expand Up @@ -74,14 +72,12 @@ func resourceArmRecoveryServicesProtectedVmCreateUpdate(d *schema.ResourceData,
client := meta.(*ArmClient).recoveryServicesProtectedItemsClient
ctx := meta.(*ArmClient).StopContext

//location := d.Get("location").(string)
resourceGroup := d.Get("resource_group_name").(string)
tags := d.Get("tags").(map[string]interface{})

vaultName := d.Get("recovery_vault_name").(string)
vmId := d.Get("source_vm_id").(string)
vmName := d.Get("source_vm_name").(string)

policyName := d.Get("backup_policy_name").(string)

protectedItemName := fmt.Sprintf("VM;iaasvmcontainerv2;%s;%s", resourceGroup, vmName)
Expand All @@ -93,7 +89,6 @@ func resourceArmRecoveryServicesProtectedVmCreateUpdate(d *schema.ResourceData,
backupPolicyId := fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/backupPolicies/%s", client.SubscriptionID, resourceGroup, vaultName, policyName)

item := backup.ProtectedItemResource{
//Location: utils.String(location),
Tags: expandTags(tags),
Properties: &backup.AzureIaaSComputeVMProtectedItem{
PolicyID: &backupPolicyId,
Expand Down Expand Up @@ -146,9 +141,6 @@ func resourceArmRecoveryServicesProtectedVmRead(d *schema.ResourceData, meta int
}

d.Set("resource_group_name", resourceGroup)
if location := resp.Location; location != nil {
d.Set("location", azureRMNormalizeLocation(*location))
}
d.Set("recovery_vault_name", vaultName)

if properties := resp.Properties; properties != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestAccAzureRMRecoveryServicesProtectedVm_basic(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
},
{ //vault cannot be deleted unless we stop backing up to it
{ //vault cannot be deleted unless we unregister all backups
Config: testAccAzureRMRecoveryServicesProtectedVm_base(ri, testLocation()),
Check: resource.ComposeTestCheckFunc(),
},
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/recovery_services_protected_vm.markdown
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: "azurerm"
page_title: "Azure Resource Manager: azurerm_recovery_services_protected_vm"
sidebar_current: "docs-azurerm-resource-recovery-services-protected_vm"
sidebar_current: "docs-azurerm-resource-recovery-services-protected-vm"
description: |-
Manages an Recovery Services Protected VM.
---
Expand Down

0 comments on commit a5af4ca

Please sign in to comment.