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

File provisioner inside a module doesn't support relative path? #14798

Closed
aleybovich opened this issue May 24, 2017 · 4 comments
Closed

File provisioner inside a module doesn't support relative path? #14798

aleybovich opened this issue May 24, 2017 · 4 comments

Comments

@aleybovich
Copy link

aleybovich commented May 24, 2017

inside a module I have the following resource:

provisioner "file" {
      source      = "${path.module}/../../../elastic-search-schema/indices/"
      destination = "~/indices"
  }

Where ${path.module} is /Users/user/dev/search-config/terraform-templates/env-dev/search-elastic/.terraform/modules/8c670c9637338be7fc134e420c6ec98b, which is a link to /Users/leyboan1/dev/search-config/terraform-templates/modules/search-elastic; I want that source to be /Users/user/dev/search-config/elastic-search-schema/indices.

When executing it I am getting an error:

module.search-elastic.null_resource.search-es: Provisioning with 'file'...
Releasing state lock. This may take a few moments...
Error applying plan:

1 error(s) occurred:

* module.search-elastic.null_resource.search-es: 1 error(s) occurred:

* Upload failed: open /Users/user/dev/search-config/terraform-templates/env-dev/search-elastic/elastic-search-schema/indices/appstore_applications.json: no such file or directory

It incorrectly expands source path (${path.module}/../../../elastic-search-schema/indices/) as /Users/user/dev/search-config/terraform-templates/env-dev/search-elastic/elastic-search-schema/indices/ when it should be /Users/user/dev/search-config/elastic-search-schema/indices/appstore_applications.json

When I output ${path.module}/../../../elastic-search-schema/indices/ as a variable, it correctly shows /Users/leyboan1/dev/search-config/terraform-templates/env-dev/search-elastic/.terraform/modules/8c670c9637338be7fc134e420c6ec98b/../../../elastic-search-schema/indices which points to the correct folder /Users/leyboan1/dev/search-config/elastic-search-schema/indices/

Any ideas?

@mharm001
Copy link

this issue is causing ugly workarounds where we need to keep track of where the location where the module is called from.

Any updates?

@webchi
Copy link

webchi commented Oct 30, 2018

Still can't copy folders to instances in 2018. This not work:

provisioner "file" {
    source     = "${path.module}/../shared/conf/"
    destination = "/tmp/"
  }
Upload failed: open /home/icha1/project/corecoin/tf-consul/.terraform/modules/shared/conf/consul.firewalld.xml: no such file or directory

But this is ok

  provisioner "file" {
    source     = "${path.module}/../shared/conf/consul.firewalld.xml"
    destination = "/tmp/consul.firewalld.xml"
  }

@hashibot
Copy link
Contributor

Hello! 🤖

This issue relates to an older version of Terraform that is no longer in active development, and because the area of Terraform it relates to has changed significantly since the issue was opened we suspect that the issue is either fixed or that the circumstances around it have changed enough that we'd need an updated issue report in order to reproduce and address it.

If you're still seeing this or a similar issue in the latest version of Terraform, please do feel free to open a new bug report! Please be sure to include all of the information requested in the template, even if it might seem redundant with the information already shared in this issue, because the internal details relating to this problem are likely to be different in the current version of Terraform.

Thanks!

@ghost
Copy link

ghost commented Sep 27, 2019

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 Sep 27, 2019
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

5 participants