You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We manage several hundred servers with Terraform. A terraform plan lasts longer than an hour, which is not very convenient. That's why we took a look at Terraform's DEBUG Log.
env TF_LOG=DEBUG TF_LOG_PATH="/tmp/terraform.log" terraform plan
First, some interesting statistics: Terraform executes 1404 API requests.
I don't know golang enough, but I tried to find out where all the requests come from.
There is a function named resourceNutanixVirtualMachineExists. I assume this function is called once for each individual VM, to check whether a VM exists.
Function resourceNutanixVirtualMachineExists calls a function named ListAllVM.
Maybe there's a good reason why you're doing this... From my point of view it can never scale that way.
Expected behavior
The list with all servers should not be fetched every time anew. A single time per terraform plan is sufficient. In this example, only five requests would be necessary instead of 2500.
Logs
I'll be happy to deliver more if necessary.
Versions
OS: Debian 8.11
Terraform: v0.11.14
Nutanix Cluster (Prism Element / AOS): Version 5.10.6 LTS
Nutanix Prism Central: 5.10.6
Terraform provider version: v1.0.2
The text was updated successfully, but these errors were encountered:
We manage several hundred servers with Terraform. A
terraform plan
lasts longer than an hour, which is not very convenient. That's why we took a look at Terraform's DEBUG Log.env TF_LOG=DEBUG TF_LOG_PATH="/tmp/terraform.log" terraform plan
First, some interesting statistics: Terraform executes 1404 API requests.
Of these, 1122 are only for listing VMs.
I don't know golang enough, but I tried to find out where all the requests come from.
resourceNutanixVirtualMachineExists
. I assume this function is called once for each individual VM, to check whether a VM exists.resourceNutanixVirtualMachineExists
calls a function namedListAllVM
.ListAllVM
calls a function namedListVM
.ListVM
makes multiple API requests to/api/nutanix/v3/vms/list
(multiple requests because of pagination).Summary:
A terraform state with ~500 servers thus leads to ~2500 requests
Maybe there's a good reason why you're doing this... From my point of view it can never scale that way.
Expected behavior
The list with all servers should not be fetched every time anew. A single time per
terraform plan
is sufficient. In this example, only five requests would be necessary instead of 2500.Logs
I'll be happy to deliver more if necessary.
Versions
The text was updated successfully, but these errors were encountered: