Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source_dir property of archive_file data source doesn't work with ${path.module} and "../" #12929

Closed
philipl opened this issue Mar 21, 2017 · 1 comment

Comments

@philipl
Copy link

philipl commented Mar 21, 2017

Terraform Version

terraform 0.9.1

Affected Resource(s)

  • archive_file

Terraform Configuration Files

data "archive_file" "function" {
    type = "zip"
    source_dir = "${path.module}/../src"
    output_path = "${path.root}/somefile.zip"
}

Debug Output

2017/03/21 09:25:52 [DEBUG] root.cloudfront: eval: *terraform.EvalReadDataApply
o:data.archive_file.function: Refreshing state...
2017/03/21 09:25:52 [ERROR] root.cloudfront: eval: *terraform.EvalReadDataApply, err: data.archive_file.function: unexpected EOF
2017/03/21 09:25:52 [ERROR] root.cloudfront: eval: *terraform.EvalSequence, err: data.archive_file.function: unexpected EOF
2017/03/21 09:25:52 [TRACE] [walkRefresh] Exiting eval tree: module.cloudfront.data.archive_file.function
2017/03/21 09:25:52 [DEBUG] plugin: terraform: panic: runtime error: invalid memory address or nil pointer dereference
2017/03/21 09:25:52 [DEBUG] plugin: terraform: [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xb02682]
2017/03/21 09:25:52 [DEBUG] plugin: terraform: 
2017/03/21 09:25:52 [DEBUG] plugin: terraform: goroutine 43 [running]:
2017/03/21 09:25:52 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/builtin/providers/archive.(*ZipArchiver).ArchiveDir.func1(0xc4204f7580, 0x7c, 0x0, 0x0, 0x73e88a0, 0xc420509ad0, 0x0, 0x0)
2017/03/21 09:25:52 [DEBUG] plugin: terraform:  /opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/archive/zip_archiver.go:65 +0x52
2017/03/21 09:25:52 [DEBUG] plugin: terraform: path/filepath.walk(0xc420582090, 0x8a, 0x74067a0, 0xc4203188f0, 0xc42015a400, 0x0, 0x20)
2017/03/21 09:25:52 [DEBUG] plugin: terraform:  /opt/go/src/path/filepath/path.go:372 +0x2fe
2017/03/21 09:25:52 [DEBUG] plugin: terraform: path/filepath.Walk(0xc420582090, 0x8a, 0xc42015a400, 0xc420318820, 0x0)
2017/03/21 09:25:52 [DEBUG] plugin: terraform:  /opt/go/src/path/filepath/path.go:398 +0x14c
2017/03/21 09:25:52 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/builtin/providers/archive.(*ZipArchiver).ArchiveDir(0xc42015a360, 0xc420582090, 0x8a, 0x0, 0x0)
2017/03/21 09:25:52 [DEBUG] plugin: terraform:  /opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/archive/zip_archiver.go:85 +0x117
2017/03/21 09:25:52 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/builtin/providers/archive.archive(0xc4202da310, 0x5f, 0x74067a0)
2017/03/21 09:25:52 [DEBUG] plugin: terraform:  /opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/archive/data_source_archive_file.go:158 +0x18d
2017/03/21 09:25:52 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/builtin/providers/archive.dataSourceFileRead(0xc4202da310, 0x0, 0x0, 0xc420238801, 0x0)
2017/03/21 09:25:52 [DEBUG] plugin: terraform:  /opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/archive/data_source_archive_file.go:123 +0xbf
2017/03/21 09:25:52 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/helper/schema.(*Resource).ReadDataApply(0xc4204fac00, 0xc42015a180, 0x0, 0x0, 0xc42036e978, 0xc420509901, 0x0)
2017/03/21 09:25:52 [DEBUG] plugin: terraform:  /opt/gopath/src/github.com/hashicorp/terraform/helper/schema/resource.go:252 +0xbb
2017/03/21 09:25:52 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/helper/schema.(*Provider).ReadDataApply(0xc4202d2930, 0xc4202494f0, 0xc42015a180, 0x7fcbfda7d960, 0x0, 0x0)
2017/03/21 09:25:52 [DEBUG] plugin: terraform:  /opt/gopath/src/github.com/hashicorp/terraform/helper/schema/provider.go:381 +0x91
2017/03/21 09:25:52 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/plugin.(*ResourceProviderServer).ReadDataApply(0xc4202b59e0, 0xc42035a440, 0xc42035a820, 0x0, 0x0)
2017/03/21 09:25:52 [DEBUG] plugin: terraform:  /opt/gopath/src/github.com/hashicorp/terraform/plugin/resource_provider.go:565 +0x4e
2017/03/21 09:25:52 [DEBUG] plugin: terraform: reflect.Value.call(0xc4202fa2a0, 0xc420300180, 0x13, 0x4c5783b, 0x4, 0xc42062df20, 0x3, 0x3, 0x4de3300, 0xc42002aee8, ...)
2017/03/21 09:25:52 [DEBUG] plugin: terraform:  /opt/go/src/reflect/value.go:434 +0x91f
2017/03/21 09:25:52 [DEBUG] plugin: terraform: reflect.Value.Call(0xc4202fa2a0, 0xc420300180, 0x13, 0xc42002af20, 0x3, 0x3, 0xc42002af0c, 0x180001, 0x300000000)
2017/03/21 09:25:52 [DEBUG] plugin: terraform:  /opt/go/src/reflect/value.go:302 +0xa4
2017/03/21 09:25:52 [DEBUG] plugin: terraform: net/rpc.(*service).call(0xc420429a80, 0xc420429a00, 0xc42037fab8, 0xc4204f6300, 0xc420411360, 0x3ee7d00, 0xc42035a440, 0x16, 0x3ee7d40, 0xc42035a820, ...)
2017/03/21 09:25:52 [DEBUG] plugin: terraform:  /opt/go/src/net/rpc/server.go:387 +0x144
2017/03/21 09:25:52 [DEBUG] plugin: terraform: created by net/rpc.(*Server).ServeCodec
2017/03/21 09:25:52 [DEBUG] plugin: terraform:  /opt/go/src/net/rpc/server.go:481 +0x404
2017/03/21 09:25:52 [DEBUG] plugin: terraform: 
2017/03/21 09:25:52 [DEBUG] plugin: /home/philipl/.local/bin/terraform: plugin process exited

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

  1. terraform plan

Important Factoids

This seems a very specific failure. The following scenarios work fine:

  1. source_dir = "${path.module}/src"
  2. source_dir = "/some/path/../src"
  3. source_file = "${path.module}/../src/filename.js"

The specific failure is when ${path.module} is combined with "../"

@ghost
Copy link

ghost commented Apr 9, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants