Skip to content

backend "remote" is copying files outside of PWD, including untracked invisibles #21809

@u2mejc

Description

@u2mejc

Terraform Version

Terraform version: 0.11.14
tfe.v2.1

Terraform Configuration Files

terraform {
  required_version = "= 0.11.14"

  backend "remote" {
    organization = "example"

    workspaces {
      name = "foobar"
    }
  }
}

Debug Output

$ time terraform plan
2019/06/19 23:20:10 [INFO] Terraform version: 0.11.14
2019/06/19 23:20:10 [INFO] Go runtime version: go1.12.4
2019/06/19 23:20:10 [INFO] CLI args: []string{"/tmp/terraform", "plan"}
2019/06/19 23:20:10 [DEBUG] Attempting to open CLI config file: /home/ubuntu/.terraformrc
2019/06/19 23:20:10 Loading CLI configuration from /home/ubuntu/.terraformrc
2019/06/19 23:20:10 [INFO] CLI command args: []string{"plan"}
2019/06/19 23:20:10 [DEBUG] Service discovery for app.terraform.io at https://app.terraform.io/.well-known/terraform.json
2019/06/19 23:20:11 [DEBUG] Retrieve version constraints for service tfe.v2.1 and product terraform
2019/06/19 23:20:12 [INFO] command: backend initialized: *remote.Remote
2019/06/19 23:20:12 [DEBUG] checking for provider in "."
2019/06/19 23:20:12 [DEBUG] checking for provider in "/tmp"
2019/06/19 23:20:12 [DEBUG] checking for provider in ".terraform/plugins/linux_amd64"
2019/06/19 23:20:12 [DEBUG] found provider "terraform-provider-aws_v2.15.0_x4"
2019/06/19 23:20:12 [DEBUG] found provider "terraform-provider-local_v1.2.2_x4"
2019/06/19 23:20:12 [DEBUG] found provider "terraform-provider-template_v2.1.2_x4"
2019/06/19 23:20:12 [DEBUG] found valid plugin: "template", "2.1.2", "/home/ubuntu/terraform/providers/aws/prod/us-east-1/.terraform/plugins/linux_amd64/terraform-provider-template_v2.1.2_x4"
2019/06/19 23:20:12 [DEBUG] found valid plugin: "aws", "2.15.0", "/home/ubuntu/terraform/providers/aws/prod/us-east-1/.terraform/plugins/linux_amd64/terraform-provider-aws_v2.15.0_x4"
2019/06/19 23:20:12 [DEBUG] found valid plugin: "local", "1.2.2", "/home/ubuntu/terraform/providers/aws/prod/us-east-1/.terraform/plugins/linux_amd64/terraform-provider-local_v1.2.2_x4"
2019/06/19 23:20:12 [DEBUG] checking for provisioner in "."
2019/06/19 23:20:12 [DEBUG] checking for provisioner in "/tmp"
2019/06/19 23:20:12 [DEBUG] checking for provisioner in ".terraform/plugins/linux_amd64"
2019/06/19 23:20:12 [INFO] backend/remote: starting Plan operation
Running plan in the remote backend. Output will stream here. Pressing Ctrl-C
will stop streaming the logs, but will not stop the plan running remotely.

Preparing the remote plan...


Error: error uploading configuration files: Failed copying file "/home/ubuntu/terraform/test.dump" to archive: archive/tar: write too long

The configured "remote" backend encountered an unexpected error. Sometimes
this is caused by network connection problems, in which case you could retry
the command. If the issue persists please open a support ticket to get help
resolving the problem.

2019/06/19 23:20:22 [DEBUG] plugin: waiting for all plugin processes to complete...

real    0m11.923s
user    0m8.988s
sys     0m0.220s

Crash Output

n/a

Expected Behavior

Terraform should not traverse out of it's PWD. It should not upload unrelated files / folders (especially those outside git control).

Actual Behavior

Terraform appears to hang indefinitely as it attempts to upload hundreds of untracked environmental file, or errors depending on file size.

Appears to be looking for the git root. But instead of transferring up a shallow copy of visible files, starting at the PWD, it attempts to upload everything from the parents, including untracked and invisible files.

Steps to Reproduce

  • cd <root of repo>
  • ln -s /dev/random testfile
  • cd <child dir with terraform code>
  • terraform init
  • terrform plan

Additional Context

References

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions