Skip to main content
The file provisioner copies files or directories from the machine running Terraform to the newly created resource. The file provisioner supports both ssh and winrm type connections. See file

Initializer

import cdktn

cdktn.FileProvisioner(
  destination: str,
  type: str,
  connection: SSHProvisionerConnection | WinrmProvisionerConnection = None,
  content: str = None,
  source: str = None
)

Properties

NameTypeDescription
destinationstrThe source file or directory.
typestrNo description.
connectionSSHProvisionerConnection | WinrmProvisionerConnectionMost provisioners require access to the remote resource via SSH or WinRM and expect a nested connection block with details about how to connect.
contentstrThe destination path to write to on the remote system.
sourcestrThe direct content to copy on the destination.

destinationRequired

destination: str
  • Type: str
The source file or directory. Specify it either relative to the current working directory or as an absolute path. This argument cannot be combined with content.

typeRequired

type: str
  • Type: str

connectionOptional

connection: SSHProvisionerConnection | WinrmProvisionerConnection
Most provisioners require access to the remote resource via SSH or WinRM and expect a nested connection block with details about how to connect.

contentOptional

content: str
  • Type: str
The destination path to write to on the remote system. See Destination Paths below for more information.

sourceOptional

source: str
  • Type: str
The direct content to copy on the destination. If destination is a file, the content will be written on that file. In case of a directory, a file named tf-file-content is created inside that directory. We recommend using a file as the destination when using content. This argument cannot be combined with source.