DimensionDataResearch / terraform-provider-ddcloud

Terraform provider for Dimension Data cloud compute.
MIT License
16 stars 13 forks source link

HTTP 400 when trying to read PRIMARY NIC IP address #130

Closed hasanhakkaev closed 5 years ago

hasanhakkaev commented 5 years ago

So basically, when it tries to notify the NIC for IPv4 change, it passes an “empty” IPv4 which causes the error, so that mean it can’t read it in the first place.This is only for the primary NIC of the vm.The additional NIC do get the correct IP notice and I can see it in the logs.

Below is the log :

2019-06-05T13:38:02.252+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 [DD] Resource Helper > SetServerNetworkAdapters ID:3a58e876-2c1a-48c4-8360-edcf9f91d07e ipv4: ipv6: <-- Additional NIC 2019-06-05T13:38:02.252+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 [DD] Resource Helper > SetServerNetworkAdapters ID:f5090fff-0e80-435d-98b6-1bfe541aa5b0 ipv4: ipv6: <-- Additional NIC 2019-06-05T13:38:02.252+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 [DD] Resource Helper > SetServerNetworkAdapters ID:3a58e876-2c1a-48c4-8360-edcf9f91d07e ipv4:10.0.53.1 ipv6:2a00:47c0:511:1476:e87:7b93:b51b:4967 <-- Additional NIC 2019-06-05T13:38:02.252+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 [DD] Resource Helper > SetServerNetworkAdapters ID:f5090fff-0e80-435d-98b6-1bfe541aa5b0 ipv4:10.0.54.1 ipv6:2a00:47c0:511:1477:63ad:39da:8e56:caa9 <-- Additional NIC

2019-06-05T13:38:02.252+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 Invoking 'GET' request to 'https://api-eu.dimensiondata.com/caas/2.2/109f866b-e870-46c7-91e0-c08433cd5355/network/natRule?networkDomainId=686a06e4-5859-4651-8815-bb0b2116bb02&pageNumber=1&pageSize=50'... 2019-06-05T13:38:02.293+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 Response from 'https://api-eu.dimensiondata.com/caas/2.2/109f866b-e870-46c7-91e0-c08433cd5355/network/natRule?networkDomainId=686a06e4-5859-4651-8815-bb0b2116bb02&pageNumber=1&pageSize=50' (200): '{"pageNumber":1,"pageCount":0,"totalCount":0,"pageSize":50}' 2019-06-05T13:38:02.293+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 [DD] resource_server > captureCreatedServerProperties() nic id:25f700d5-7096-4ca8-a241-16b2eeabb655 ipv4: ipv6: <- THIS IS PRIMARY NIC OF THE VM! 2019-06-05T13:38:02.293+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 Update IP address(es) for network adapter '25f700d5-7096-4ca8-a241-16b2eeabb655'. 2019-06-05T13:38:02.293+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 Do.Action - stateLock.Lock() 2019-06-05T13:38:02.293+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 Do.Action - stateLock.Unlock() 2019-06-05T13:38:02.293+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 Update IP address info for network adapter '25f700d5-7096-4ca8-a241-16b2eeabb655' - will attempt operation once every 30 seconds until successful (timeout after 600 seconds)... 2019-06-05T13:38:02.293+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 Update IP address info for network adapter '25f700d5-7096-4ca8-a241-16b2eeabb655' - performing initial attempt... 2019-06-05T13:38:02.293+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 Update IP address info for network adapter '25f700d5-7096-4ca8-a241-16b2eeabb655' acquiring global asynchronous operation lock... 2019-06-05T13:38:02.293+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 Update IP address info for network adapter '25f700d5-7096-4ca8-a241-16b2eeabb655' acquired global asynchronous operation lock. 2019-06-05T13:38:02.293+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 [DD] resource_server_network > modifyServerNetworkAdapterIP - Updating NIC id:25f700d5-7096-4ca8-a241-16b2eeabb655 ipv4: ipv6: 2019-06-05T13:38:02.293+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 Invoking 'POST' request to 'https://api-eu.dimensiondata.com/caas/2.9/109f866b-e870-46c7-91e0-c08433cd5355/server/notifyNicIpChange'... 2019-06-05T13:38:02.293+0200 [DEBUG] plugin.terraform-provider-ddcloud.exe: 2019/06/05 13:38:02 Request body: '{"nicId":"25f700d5-7096-4ca8-a241-16b2eeabb655","privateIpv4":""}'

samuelchong commented 5 years ago

fixed. It will be available in next release.

samuelchong commented 5 years ago

in the meantime, you could workaround it by removing any ipv4 attribute with an empty value.

samuelchong commented 5 years ago

Fixed in terraform-provider-ddcloud v2.2.2