Open hashibot opened 7 years ago
I think I just hit the same thing, except the error I'm getting is:
data.archive_file.source_code: unexpected EOF
Still happens with terraform v0.10.7 and archive 1.0.0 provider
Still happening with Terraform v0.11.3
Except i get an
unexpected EOF
Can confirm this is still a problem with:
Terraform v0.11.7
+ provider.archive v1.0.3
panic:
panic: runtime error: invalid memory address or nil pointer dereference
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x15af6f2]
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4:
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: goroutine 25 [running]:
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: github.com/terraform-providers/terraform-provider-archive/archive.(*ZipArchiver).ArchiveDir.func1(0xc420206040, 0x3b, 0x0, 0x0, 0x1aeb9a0, 0xc420212360, 0x0, 0x0)
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-archive/archive/zip_archiver.go:86 +0x52
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: path/filepath.walk(0xc4202143c0, 0x5a, 0x1af3ca0, 0xc42029e410, 0xc4202086a0, 0x0, 0x20)
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: /usr/local/go/src/path/filepath/path.go:377 +0x2eb
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: path/filepath.Walk(0xc4202143c0, 0x5a, 0xc4202086a0, 0xc42029e340, 0x0)
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: /usr/local/go/src/path/filepath/path.go:403 +0x11d
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: github.com/terraform-providers/terraform-provider-archive/archive.(*ZipArchiver).ArchiveDir(0xc420208660, 0xc4202143c0, 0x5a, 0x0, 0x0)
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-archive/archive/zip_archiver.go:85 +0x108
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: github.com/terraform-providers/terraform-provider-archive/archive.archive(0xc420294380, 0x21, 0x1af3ca0)
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-archive/archive/data_source_archive_file.go:158 +0x18d
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: github.com/terraform-providers/terraform-provider-archive/archive.dataSourceFileRead(0xc420294380, 0x0, 0x0, 0xc42029c1c0, 0xc)
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-archive/archive/data_source_archive_file.go:123 +0xb2
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: github.com/terraform-providers/terraform-provider-archive/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).ReadDataApply(0xc4202ca720, 0xc420208520, 0x0, 0x0, 0xc4202decb8, 0xc420212201, 0x80000000018)
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-archive/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:259 +0xb0
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: github.com/terraform-providers/terraform-provider-archive/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).ReadDataApply(0xc4202c0230, 0xc42020e050, 0xc420208520, 0x1cb8d90, 0x0, 0x18)
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-archive/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:398 +0x9a
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: github.com/terraform-providers/terraform-provider-archive/vendor/github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).ReadDataApply(0xc4202bc600, 0xc4202920f0, 0xc420292260, 0x0, 0x0)
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: /opt/teamcity-agent/work/222ea50a1b4f75f4/src/github.com/terraform-providers/terraform-provider-archive/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go:565 +0x4e
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: reflect.Value.call(0xc420246d80, 0xc420264998, 0x13, 0x1717f5c, 0x4, 0xc420241f20, 0x3, 0x3, 0x0, 0x0, ...)
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: /usr/local/go/src/reflect/value.go:434 +0x905
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: reflect.Value.Call(0xc420246d80, 0xc420264998, 0x13, 0xc420254f20, 0x3, 0x3, 0x1148bfa, 0x1, 0x0)
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: /usr/local/go/src/reflect/value.go:302 +0xa4
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: net/rpc.(*service).call(0xc420229940, 0xc4202629b0, 0xc42023b670, 0xc42027b380, 0xc42024ff80, 0x15fbb60, 0xc4202920f0, 0x16, 0x15fbba0, 0xc420292260, ...)
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: /usr/local/go/src/net/rpc/server.go:381 +0x142
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: created by net/rpc.(*Server).ServeCodec
2018-05-24T21:57:25.689-0700 [DEBUG] plugin.terraform-provider-archive_v1.0.3_x4: /usr/local/go/src/net/rpc/server.go:475 +0x36b
2018/05/24 21:57:25 [ERROR] root.test: eval: *terraform.EvalReadDataApply, err: data.archive_file.function: unexpected EOF
2018/05/24 21:57:25 [ERROR] root.test: eval: *terraform.EvalSequence, err: data.archive_file.function: unexpected EOF
2018/05/24 21:57:25 [TRACE] [walkRefresh] Exiting eval tree: module.test.data.archive_file.function
2018/05/24 21:57:25 [TRACE] dag/walk: upstream errored, not walking "provider.archive (close)"
2018/05/24 21:57:25 [DEBUG] plugin: waiting for all plugin processes to complete...
2018-05-24T21:57:25.691-0700 [WARN ] plugin: error closing client during Kill: err="connection is shut down"
2018-05-24T21:57:25.691-0700 [DEBUG] plugin: plugin process exited: path=/Users/kt/hashi/2018/gh/archive-5/.terraform/plugins/darwin_amd64/terraform-provider-archive_v1.0.3_x4
Hi @reg0l, @thyrion, @brikis98, @philipl,
Thank you for opening and commenting on this issue. I have fixed the panic (#26) and can now see what is actually happening here:
[23:21:56] kt@snowbook:~/hashi/2018/gh/archive-5$ cat main.tf
module "test" {
source = "m"
}
[23:22:00] kt@snowbook:~/hashi/2018/gh/archive-5$ cat m/m.tf
data "archive_file" "function" {
type = "zip"
source_dir = "${path.module}/../m"
output_path = "${path.root}/somefile.zip"
}
[23:22:27] kt@snowbook:~/hashi/2018/gh/archive-5$ tfinitautoapply
Initializing modules...
- module.test
[...]
data.archive_file.function: Refreshing state...
Error: Error refreshing state: 1 error(s) occurred:
* module.test.data.archive_file.function: 1 error(s) occurred:
* module.test.data.archive_file.function: data.archive_file.function: error archiving directory: error encountered during file walk: lstat /Users/kt/hashi/2018/gh/archive-5/.terraform/modules/m/m.tf: no such file or directory
[23:22:49] kt@snowbook:~/hashi/2018/gh/archive-5$
It seems ${path.module}../path
is confusing terraform because terraform is actually running the module out of a symlink in the .terraform
directory:
[23:30:17] kt@snowbook:~/hashi/2018/gh/archive-5/.terraform/modules$ l
total 8
lrwxr-xr-x 1 kt staff 35B 24 May 22:59 d8e8c5c9d3f2ba57af0e123ff8f18055 -> /Users/kt/hashi/2018/gh/archive-5/m
I've run out of time to spend on this tonight but at least now there will be a reasonable error 🙂
Just ran into this problem:
Terraform code:
data "archive_file" "geodetection" {
type = "zip"
source_dir = "${path.module}/../../../../dev/lambda-edge-geodetection"
output_path = "${path.module}/lambda-edge-geodetection.zip"
}
Apply result:
Error: Error refreshing state: 1 error(s) occurred:
* module.edgelambda.data.archive_file.geodetection: 1 error(s) occurred:
* module.edgelambda.data.archive_file.geodetection: data.archive_file.geodetection: unexpected EOF
Had to change to this and it worked...
source_dir = "${path.root}/../../../dev/lambda-edge-geodetection"
I can confirm that @swoodford's solution of replacing ${path.module}
with ${path.root}
works. It's actually a better solution for my problem but I am wondering if
${path.root}
and what's causing it to act differently than ${path.module}
${path.module}/../../../this-will-not-work/
problemOther than that, the archive_file
provider is amazing! Keep up the great work!
came across this issue as well
I've tried both ${path.module}
and ${path.root}
and neither work for me. I'm able to use ../../apollo-sequelize-terra-test/lambda
in the terminal from my terraform's root dir to get to the folder that I want.
When I add ${path.module}
or ${path.root}
in front of that I get the could not archive missing directory error
.
Anyone have a solution?
I'm seeing the same as @codeinaire
Neither ${path.module}
nor ${path.root}
are working.
Terraform v0.12.17 and this is happening, my terminal just hangs at
data.archive_file.deployment_package: Refreshing state...
------------------------------------------------------------------------
no error message stayed like that for 5 minutes
The archive_file is a single python script with 11 lines.
And I tried with and without ${path.module}
defined like this:
data "archive_file" "deployment_package" {
type = "zip"
source_file = "function.py"
output_path = "function.zip"
}
I would not maintain #8344 (https://github.com/hashicorp/terraform/issues/8344) closed, although I do not have access.
This issue was originally opened by @philipl as hashicorp/terraform#12929. It was migrated here as part of the provider split. The original body of the issue is below.
Terraform Version
terraform 0.9.1
Affected Resource(s)
Terraform Configuration Files
Debug Output
Panic Log
https://gist.github.com/philipl/e5108167c11c17f2b96564e81e34e0fc
Expected Behavior
zip file is created with contents of directory
Actual Behavior
empty zip file is created and crash is reported in debug output
Steps to Reproduce
terraform plan
Important Factoids
This seems a very specific failure. The following scenarios work fine:
source_dir = "${path.module}/src"
source_dir = "/some/path/../src"
source_file = "${path.module}/../src/filename.js"
The specific failure is when ${path.module} is combined with "../"