terraform-provider-netapp-cloudmanager
terraform-provider-netapp-cloudmanager copied to clipboard
Parameter naming consistency in Data Connector Azure for vnet and subnet ID's
I was creating a Data connector in Azure and found a bit confusing the parameters requirements for vnet_id and subnet_id as they are not looking for the resources ID's instead looking for the vnet and subnet names respectively, looking at the code below (occm_azure.go lines 93-104)I can see the Resource ID string gets created based on the parameters provided.
if occmDetails.VnetResourceGroup != "" { registerAgentTOService.Placement.Network = fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/virtualNetworks/%s", occmDetails.SubscriptionID, occmDetails.VnetResourceGroup, occmDetails.VnetID) } else { registerAgentTOService.Placement.Network = fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/virtualNetworks/%s", occmDetails.SubscriptionID, occmDetails.ResourceGroup, occmDetails.VnetID) } registerAgentTOService.Placement.Subnet = fmt.Sprintf("%s/subnets/%s", registerAgentTOService.Placement.Network, occmDetails.SubnetID) userData, newClientID, err := c.getCustomData(registerAgentTOService, proxyCertificates, clientID) if err != nil { return OCCMMResult{}, err }
I can see there are two options
-
Replace the parameters
vnet_idandsubnet_idforvnet_nameandsubnet_nameto be consistent with the AzureRM provider. -
Provide
vnet_idandsubnet_idas the Resource ID's of the resources and removing the string manipulation to generate the Resource ID within the code. Provisioning infrastructure using terraform we can pass on this ID as part of the vnet and subnet creation as those attributes are exportable e.g.azurerm_virtual_network. However, that will mean a breaking change. Hope that provides some context