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

Copy files from Remote to Local? #3379

Open
chiriaev opened this issue Oct 1, 2015 · 25 comments
Open

Copy files from Remote to Local? #3379

chiriaev opened this issue Oct 1, 2015 · 25 comments

Comments

@chiriaev
Copy link

chiriaev commented Oct 1, 2015

Guys, Hi. Thanks again for this formidable tool. I am doing a PoC as we speak. In this context, is it possible to copy file resources from a remote server instance to a local folder? If not, should it be an enhancement request? Opinions? Votes?

Regards, Andrei

@apparentlymart
Copy link
Contributor

Support for this was recently added in Packer, but Terraform's file provisioner doesn't support it yet. I think a PR would be welcomed to allow similar sorts of use-cases as the Packer feature, and I think I have some use-cases that could benefit from it.

@HX-Rd
Copy link

HX-Rd commented Mar 30, 2016

Does anyone have an opinion how this should be implemented? Was wondering if this feature should be implemented in the file provisioner ( and add a variable that specifies the direction of the transfer ) or should this be another provisioner ( file-remote maybe? )

@igormoochnick
Copy link

Any progress on this issue?
Our use case involves configuration of freIPA cluster where a "replica" seed file is created on the master and then moved to the replica machine and executed there. So I need a way to copy something from one remote machine to the local machine and then I need to push this to another remote machine.

@kalbasit
Copy link

@igormoochnick you could use regular SCP. See this for an example.

@dimon222
Copy link

Really looking for such feature. Direction functionality would make it even better.

@stvdilln
Copy link

I'd also like this. My use case is a terraform that could run on Windows or Linux, so just using SCP is complicated on the windows side.

@koalalorenzo
Copy link

Any update on this? It would simplify and remove a lot of workarounds we all have at the moment to solve the lack of this issue.

@HX-Rd
Copy link

HX-Rd commented May 1, 2017

I implemented this a while back but did not get around to do a pull request since I had not done a proper testing on it and it was good enough for my use case at the time. Here is the branch https://github.com/HX-Rd/terraform/tree/file-provisioner-remote-to-local
Can't really take much credit for this one though since its basically just the packer implementation.

@ghost
Copy link

ghost commented Sep 19, 2017

This is a must-have for me. When setting up tinc, public keys are generated on remote machines as part of the provisioning process, which need to be downloaded locally and then distributed to all remote machines.

@okgolove
Copy link

I really need this feature.
I need to copy K8s client auth certificates stored on bastion to my host.

@salsa-dev
Copy link

salsa-dev commented Mar 16, 2018

I'm finding way to copy chef's user cert when bootstraping chef-server.

@pfremm
Copy link

pfremm commented Apr 21, 2018

I'd like this feature as well.

@anmiles
Copy link

anmiles commented Apr 28, 2018

I also need this feature

@leonardocastanodiaz
Copy link

+1

@balupton
Copy link

balupton commented May 9, 2018

@kalbasit's suggestion worked fine for us, so no need for this request anymore. Here is our code.

Add the host to trusted hosts:
https://github.com/bevry/terraform-scaleway-hashistack/blob/b0a5337e6aa4b0d43cf833172b943af7585760f5/helpers/scripts/local_begin#L23-L33

Copy the remote files to local:
https://github.com/bevry/terraform-scaleway-hashistack/blob/b0a5337e6aa4b0d43cf833172b943af7585760f5/helpers/scripts/local_end#L20-L24

@rallyben
Copy link

rallyben commented Jul 9, 2018

+1
My use-case is downloading lambda zip files from Artifactory before including them in the aws_lambda_function resource. It is more appealing than installing them is an S3 bucket during build and referencing that URL by some convention

@keiranmraine
Copy link

keiranmraine commented Aug 15, 2018

local-exec and scp alone should be able to get a file. OpenStack example:

provisioner "local-exec" {
  command = "scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i ${var.openstack_keypair} ubuntu@${openstack_networking_floatingip_v2.wr_manager_fip.address}:~/client.token ."
}

@lewandom
Copy link

+1. Similar use case as @okgolove - copy Kube serviceaccount token from remote to local.

@Freeze
Copy link

Freeze commented Nov 12, 2018

I would support this existing. I can hack it up with Bash, but this would still be super useful.

@apparentlymart
Copy link
Contributor

Hi all! Posting a 👍 reaction on the original comment for this issue is the best way to indicate support for it, since we use reaction counts as an input to prioritization. Posting "+1" comments does not have that effect, and also creates notification noise for the many people already following this issue.

@dpothi
Copy link

dpothi commented Dec 28, 2018

👍

@guillermo-menjivar
Copy link

any updates on this ?

@hakkurt
Copy link

hakkurt commented Jun 3, 2019

I also need this feature.

@tomer-1
Copy link

tomer-1 commented Jul 31, 2019

we're working with atlantis here.
this is a must feature for dynamically updating lambdas from artifactory.

@teamterraform
Copy link
Contributor

Hi folks,
As @apparentlymart said earlier, +1 comments do not help us prioritize issues, but they do create noise for everyone watching the issue. We've already agreed that this is a solid feature request and will review a PR. Since there hasn't been any new information in the +1 comments,
I am going to lock this issue.

You can still add 👍 to the original issue comment to add your support to this enhancement request.

@hashicorp hashicorp locked and limited conversation to collaborators Jul 31, 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