ManageIQ / manageiq-providers-ibm_terraform

Apache License 2.0
2 stars 27 forks source link

Update Azure ems_ref to match Azure Provider #47

Closed k-chu closed 3 years ago

k-chu commented 4 years ago

The format for the Azure virtual_instance_ref returned by Terraform is different from the one ManageIQ Azure provider creates. This change will modify the one from Terraform to match the one from Azure provider so that we can link the two vm's.

Terraform virtual_instance_ref: /subscriptions/0e0a4200-8719-4849-bb0b-abcde/resourceGroups/virtualmachine-tm-071b00e5-rg/providers/Microsoft.Compute/virtualMachines/virtualmachine-tm-vm

ManageIQ Azure provider : 0e0a4200-8719-4849-bb0b-abcde/virtualmachine-tm-071b00e5-rg/microsoft.compute/virtualmachines/virtualmachine-tm-vm

Fix for https://github.com/ManageIQ/manageiq-providers-ibm_terraform/issues/45

k-chu commented 4 years ago

@miq-bot add_label kasparov/yes?

k-chu commented 3 years ago

Hi @agrare

Thanks for the review. It seems in the case of Azure, the only id we can matchup with Azure VMs is the one stored as ems_ref. I looked through our Terraform state file and have not found the value they use for uid_ems

In the case of VMware, the virtual_instance_ref matches the uid_ems in VMs

I compared between the Vmware and Azure vms and these are the values i see.

VMware - Configured Systems

VMware-ConfiguredSystems

VMware - VMs

VMware-Vms
Azure - Configured Systems hostname virtual_instance_ref
virtualmachine-tm-vm /subscriptions/0e0a4287-8719-4849-bb0b-5242e4507709/resourceGroups/virtualmachine-tm-075b00e5-rg/providers/Microsoft.Compute/virtualMachines/virtualmachine-tm-vm
Azure - VMs name uid_ems ems_ref
virtualmachine-tm-vm b70ad672-e302-4124-b771-f7f2e64dc6f8 0e0a4287-8719-4849-bb0b-5242e4507709/virtualmachine-tm-075b00e5-rg/microsoft.compute/virtualmachines/virtualmachine-tm-vm
agrare commented 3 years ago

Okay if VMware needs to use uid_ems and Azure needs to use ems_ref we're going to need to create a new inventory_collection for azure vms in the persister.

I think we should rename the current vms collection to vms_by_uid_ems and add a new one called vms_by_ems_ref.

miq-bot commented 3 years ago

Checked commit https://github.com/k-chu/manageiq-providers-ibm_terraform/commit/7a6d285c6dd409c528df771ab7d478da9d16ae01 with ruby 2.6.3, rubocop 0.82.0, haml-lint 0.35.0, and yamllint 3 files checked, 0 offenses detected Everything looks fine. :trophy:

simaishi commented 3 years ago

Kasparov backport details:

$ git log -1
commit 0855063c73c1a5363bdd1c3d059a5abe42c2ecee
Author: Adam Grare <agrare@redhat.com>
Date:   Thu Nov 12 16:22:06 2020 -0500

    Merge pull request #47 from k-chu/fix_azure_ems_ref

    Update Azure ems_ref to match Azure Provider

    (cherry picked from commit c7b9ffef19881e484c0767dc7142aa60a1c534a2)