Giter Site home page Giter Site logo

Comments (11)

swoodford avatar swoodford commented on July 4, 2024 2

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"

from terraform-provider-archive.

brikis98 avatar brikis98 commented on July 4, 2024 1

I think I just hit the same thing, except the error I'm getting is:

data.archive_file.source_code: unexpected EOF

from terraform-provider-archive.

katbyte avatar katbyte commented on July 4, 2024 1

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 🙂

from terraform-provider-archive.

thyrion avatar thyrion commented on July 4, 2024

Still happens with terraform v0.10.7 and archive 1.0.0 provider

from terraform-provider-archive.

reg0l avatar reg0l commented on July 4, 2024

Still happening with Terraform v0.11.3

  • provider.archive v1.0.0

Except i get an

unexpected EOF

from terraform-provider-archive.

katbyte avatar katbyte commented on July 4, 2024

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

from terraform-provider-archive.

dumrauf avatar dumrauf commented on July 4, 2024

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

  1. that's intended behaviour of ${path.root} and what's causing it to act differently than ${path.module}
  2. there are any plans to fix the ${path.module}/../../../this-will-not-work/ problem

Other than that, the archive_file provider is amazing! Keep up the great work!

from terraform-provider-archive.

rolandjohann avatar rolandjohann commented on July 4, 2024

came across this issue as well

from terraform-provider-archive.

codeinaire avatar codeinaire commented on July 4, 2024

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?

from terraform-provider-archive.

mtranter avatar mtranter commented on July 4, 2024

I'm seeing the same as @codeinaire
Neither ${path.module} nor ${path.root} are working.

from terraform-provider-archive.

ricoms avatar ricoms commented on July 4, 2024

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 (hashicorp/terraform#8344) closed, although I do not have access.

from terraform-provider-archive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.