Terraform slow to start on Windows. Known issue or just me?

Viewed 932

Running the Terraform binary on Windows is repeatedly slow to execute. Running the application on mac/linux, it's nearly instant to start and finish for a simple outputs.tf only (no main.tf)

output "0" {
  value = "${cidrsubnet(var.app_vpc_cidr, 7, 0)}"
}
output "1" {
  value = "${cidrsubnet(var.app_vpc_cidr, 7, 1)}"
}
output "2" {
  value = "${cidrsubnet(var.app_vpc_cidr, 7, 2)}"
}

Running a command line of:

$ date; time terraform.exe apply; date

Gives an output of:

Tue, Oct 03, 2017  3:07:00 PM

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

0 = 10.11.0.0/23
1 = 10.11.2.0/23
2 = 10.11.4.0/23

real    0m13.098s
user    0m1.217s
sys     0m0.140s
Tue, Oct 03, 2017  3:07:13 PM

Okay, so it started at 3:07:00 And ended at 3:07:13

13 seconds

The first 3 lines of the log (TRACE) shows this:

2017/10/03 15:07:12 [INFO] Terraform version: 0.10.6  8712b03839d1f63c0bfe11cf5f08e94014aeb85c
2017/10/03 15:07:12 [INFO] Go runtime version: go1.9
2017/10/03 15:07:12 [INFO] CLI args: []string{"C:\\dev\\terraform\\terraform.exe", "apply"}

12 seconds between launch and output.

I've had durations upwards of 45 seconds, some spent in startup like above, while others were in mid or end process, with no indication of waiting for any resources (using the same outputs.tf only)

2017/10/03 01:32:36 [TRACE] [walkValidate] Exiting eval tree: meta.count-boundary (count boundary fixup)
2017/10/03 01:32:42 [INFO] backend/local: apply calling Refresh

Is this known behavior for Windows? Or, is there something I can turn on/off on my system to improve this?

Thank you!

3 Answers

If you're still on version 0.10, I'd highly recommend updating to version 1.x or higher as there have been multiple performance enhancements made since the v0.10 release.

I also recall having ridiculous performance issues years ago even when just running terraform version. With version 1.x, on the same machine, I haven't had any such performance problems.

I'd agree with what Tasos P has mentioned, check your antivirus software to ensure it's not getting scanned every time it's running (some antivirus do behavior detection). If you are running default windows (Just using Windows Defender) you should not have a problem.

Another thing to consider is disk IO bottlenecks and other processes running on the computer. By turning on the verbose level to TRACE you can see the call times between the steps in the terraform engine and can figure out if this is a UI bottleneck or the host machine it's running on is low on resources for this to run effectively.

It may depend upon from where you are running terraform on Windows.

I think it might run bit faster if you are running it from cmd or Powershell then running the same command on WSL or Git bash or any other command line interface.

Related