Skip to content
Terraform Provider for SFTP
Go Makefile HCL
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Build Status

Terraform Provider for SFTP

A Terraform Provider which adds SFTP functionality.


  • Terraform 0.11+
  • Go 1.13 (to build the provider plugin)

Building the Provider

Clone repository to: $GOPATH/src/

$ mkdir -p $GOPATH/src/; cd $GOPATH/src/
$ git clone

Enter the provider directory, initialize and build the provider

$ cd $GOPATH/src/
$ make init
$ make build

Using the Provider

If you're building the provider, follow the instructions to install it as a plugin. After placing it into your plugins directory, run terraform init to initialize it.

Data Sources

Remote File (sftp_remote_file)

  • allow_missing - (Optional) Whether to ignore that the file is missing. Defaults to false.
  • host - (Required) The remote host.
  • host_key - (Optional) The remote host's key. Defaults to an empty string.
  • password - (Optional) The password for the remote host. Defaults to an empty string (use private_key for key based authorization).
  • path - (Required) The absolute path to the file.
  • port - (Optional) The port number for the remote host.
  • private_key - (Optional) The private key for the remote host. Defaults to an empty string (use password for regular password authorization).
  • timeout - (Optional) The connect timeout. Defaults to 5m (5 minutes).
  • triggers - (Optional) The triggers.
  • user - (Required) The username for the remote host.
  • contents - The file contents.
  • last_modified - The last modified timestamp of the file.
  • size - The file size (in bytes).

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.12+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin to your $PATH.

To compile the provider, run make build. This will build the provider and put the provider binary in the $GOPATH/bin directory.

$ make build
$ $GOPATH/bin/terraform-provider-sftp

If you wish to contribute to the provider, please see

Testing the Provider

In order to test the provider, you can simply run make test.

$ make test

Tests are limited to regression tests, ensuring backwards compability.

You can’t perform that action at this time.