Terraform: On Windows, an absolute plan file path makes terraform apply silently exit with status 1

Created on 2 Sep 2019  路  2Comments  路  Source: hashicorp/terraform

Terraform Version

terraform -v                                                                                                                                                                                                                        Terraform v0.12.7
+ provider.null v2.1.2

Terraform Configuration Files

resource "null_resource" "crash" {}

Steps to Reproduce

Please list the full steps required to reproduce the issue, for example:

  1. terraform init
  2. terraform plan -out "C:\Temp\crash\plan.tfplan"
  3. terraform apply "C:\Temp\crash\plan.tfplan"

Expected Behavior

The plan is applied

Actual Behavior

Terraform exits with no error but an exit code of 1.
Using the relative path to the plan works as expected:
terraform apply "plan.tfplan"

I've also tried with

terraform apply "C:\\Temp\\crash\\plan.tfplan"

terraform apply "C:/Temp/crash/plan.tfplan"

Debug Output

C:\Temp\crash> terraform apply "C:\Temp\crash\plan.tfplan"
2019/09/02 16:18:58 [INFO] Terraform version: 0.12.7  
2019/09/02 16:18:58 [INFO] Go runtime version: go1.12.9
2019/09/02 16:18:58 [INFO] CLI args: []string{"C:\\ProgramData\\chocolatey\\lib\\terraform\\tools\\terraform.exe", "apply", "C:\\Temp\\crash\\plan.tfplan"}
2019/09/02 16:18:58 [DEBUG] Attempting to open CLI config file: C:\Users\henry.buckle\AppData\Roaming\terraform.rc
2019/09/02 16:18:58 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/09/02 16:18:58 [INFO] CLI command args: []string{"apply", "C:\\Temp\\crash\\plan.tfplan"}
bug cli windows

Most helpful comment

An update, using the extended length prefix works:

terraform apply "\\?\C:\Temp\crash\plan.tfplan"

All 2 comments

An update, using the extended length prefix works:

terraform apply "\\?\C:\Temp\crash\plan.tfplan"

Any update on this? I'm running into the same issue.

Was this page helpful?
0 / 5 - 0 ratings