-
Notifications
You must be signed in to change notification settings - Fork 18
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
[feature request] Mimic "scp -r" #58
Comments
It seems like easyssh can do an if f.Source != "" {
src, srcErr := os.Open(f.Source)
if srcErr != nil {
_, _ = config.Debug("Failed to open source file %s: %v\n", f.Source, srcErr)
return srcErr
}
srcStat, statErr := src.Stat()
if statErr != nil {
_, _ = config.Debug("Failed to stat source file %s: %v\n", f.Source, statErr)
_ = src.Close()
return statErr
}
_ = ssh.WriteFile(src, srcStat.Size(), f.Destination)
_, _ = config.Debug("Copied %s to remote file %s:%s: %d bytes\n", f.Source, ssh.Server, f.Destination, srcStat.Size())
_ = src.Close()
} it could be like this: if f.Source != "" {
err := ssh.Scp(f.Source, f.Destination)
if err != nil {
config.Debug("Failed to copy file(s) %s: %v\n", f.Source, err)
return err
}
} |
Hi @denismakogon , we have a similar use cases but have been using data "archive_file" "data" {
type = "zip"
source_dir = "/tmp/data"
output_path = "/tmp/data.zip"
}
resource "ssh_resource" "test" {
host = "vorlon.terrakube.com"
user = "andy"
agent = true
port = "22"
pre_commands = [
"mkdir -p /tmp/test"
]
file {
source = "/tmp/data.zip" // Local
destination = "/tmp/data.zip" // Remote
permissions = "0700"
}
commands = [
"unzip -o /tmp/data.zip -d /tmp/data"
]
} Will definitely have a look at the |
It's good to see that this module can copy files (multiple if using
dynamic "..." { }
) over the wire, but it's not that simple to implement the "walk-directory" functionality using the built-infileset
TF function. So, since you already have the functionality to copy put a file onto a disk, maybe there should also be a way to "deep copy" the whole directory by providing a path to it?The text was updated successfully, but these errors were encountered: