> ## Documentation Index
> Fetch the complete documentation index at: https://cdktn.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Python: SSHProvisionerConnection

> CDKTN Core API Reference for SSHProvisionerConnection in Python.

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

Refer to [connection](https://developer.hashicorp.com/terraform/language/resources/provisioners/connection)

## Initializer <a name="Initializer" id="cdktn.SSHProvisionerConnection.Initializer" />

```python theme={null}
import cdktn

cdktn.SSHProvisionerConnection(
  host: str,
  type: str,
  agent: str = None,
  agent_identity: str = None,
  bastion_certificate: str = None,
  bastion_host: str = None,
  bastion_host_key: str = None,
  bastion_password: str = None,
  bastion_port: typing.Union[int, float] = None,
  bastion_private_key: str = None,
  bastion_user: str = None,
  certificate: str = None,
  host_key: str = None,
  password: str = None,
  port: typing.Union[int, float] = None,
  private_key: str = None,
  proxy_host: str = None,
  proxy_port: typing.Union[int, float] = None,
  proxy_scheme: str = None,
  proxy_user_name: str = None,
  proxy_user_password: str = None,
  script_path: str = None,
  target_platform: str = None,
  timeout: str = None,
  user: str = None
)
```

## Properties <a name="Properties" id="Properties" />

| **Name**                                                                                                    | **Type**                               | **Description**                                                                                         |
| ----------------------------------------------------------------------------------------------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| <code><a href="#cdktn.SSHProvisionerConnection.property.host">host</a></code>                               | <code>str</code>                       | The address of the resource to connect to.                                                              |
| <code><a href="#cdktn.SSHProvisionerConnection.property.type">type</a></code>                               | <code>str</code>                       | The connection type.                                                                                    |
| <code><a href="#cdktn.SSHProvisionerConnection.property.agent">agent</a></code>                             | <code>str</code>                       | Set to false to disable using ssh-agent to authenticate.                                                |
| <code><a href="#cdktn.SSHProvisionerConnection.property.agentIdentity">agent\_identity</a></code>           | <code>str</code>                       | The preferred identity from the ssh agent for authentication.                                           |
| <code><a href="#cdktn.SSHProvisionerConnection.property.bastionCertificate">bastion\_certificate</a></code> | <code>str</code>                       | The contents of a signed CA Certificate.                                                                |
| <code><a href="#cdktn.SSHProvisionerConnection.property.bastionHost">bastion\_host</a></code>               | <code>str</code>                       | Setting this enables the bastion Host connection.                                                       |
| <code><a href="#cdktn.SSHProvisionerConnection.property.bastionHostKey">bastion\_host\_key</a></code>       | <code>str</code>                       | The public key from the remote host or the signing CA, used to verify the host connection.              |
| <code><a href="#cdktn.SSHProvisionerConnection.property.bastionPassword">bastion\_password</a></code>       | <code>str</code>                       | The password to use for the bastion host.                                                               |
| <code><a href="#cdktn.SSHProvisionerConnection.property.bastionPort">bastion\_port</a></code>               | <code>typing.Union\[int, float]</code> | The port to use connect to the bastion host.                                                            |
| <code><a href="#cdktn.SSHProvisionerConnection.property.bastionPrivateKey">bastion\_private\_key</a></code> | <code>str</code>                       | The contents of an SSH key file to use for the bastion host.                                            |
| <code><a href="#cdktn.SSHProvisionerConnection.property.bastionUser">bastion\_user</a></code>               | <code>str</code>                       | The user for the connection to the bastion host.                                                        |
| <code><a href="#cdktn.SSHProvisionerConnection.property.certificate">certificate</a></code>                 | <code>str</code>                       | The contents of a signed CA Certificate.                                                                |
| <code><a href="#cdktn.SSHProvisionerConnection.property.hostKey">host\_key</a></code>                       | <code>str</code>                       | The public key from the remote host or the signing CA, used to verify the connection.                   |
| <code><a href="#cdktn.SSHProvisionerConnection.property.password">password</a></code>                       | <code>str</code>                       | The password to use for the connection.                                                                 |
| <code><a href="#cdktn.SSHProvisionerConnection.property.port">port</a></code>                               | <code>typing.Union\[int, float]</code> | The port to connect to.                                                                                 |
| <code><a href="#cdktn.SSHProvisionerConnection.property.privateKey">private\_key</a></code>                 | <code>str</code>                       | The contents of an SSH key to use for the connection.                                                   |
| <code><a href="#cdktn.SSHProvisionerConnection.property.proxyHost">proxy\_host</a></code>                   | <code>str</code>                       | Setting this enables the SSH over HTTP connection.                                                      |
| <code><a href="#cdktn.SSHProvisionerConnection.property.proxyPort">proxy\_port</a></code>                   | <code>typing.Union\[int, float]</code> | The port to use connect to the proxy host.                                                              |
| <code><a href="#cdktn.SSHProvisionerConnection.property.proxyScheme">proxy\_scheme</a></code>               | <code>str</code>                       | The ssh connection also supports the following fields to facilitate connections by SSH over HTTP proxy. |
| <code><a href="#cdktn.SSHProvisionerConnection.property.proxyUserName">proxy\_user\_name</a></code>         | <code>str</code>                       | The username to use connect to the private proxy host.                                                  |
| <code><a href="#cdktn.SSHProvisionerConnection.property.proxyUserPassword">proxy\_user\_password</a></code> | <code>str</code>                       | The password to use connect to the private proxy host.                                                  |
| <code><a href="#cdktn.SSHProvisionerConnection.property.scriptPath">script\_path</a></code>                 | <code>str</code>                       | The path used to copy scripts meant for remote execution.                                               |
| <code><a href="#cdktn.SSHProvisionerConnection.property.targetPlatform">target\_platform</a></code>         | <code>str</code>                       | The target platform to connect to.                                                                      |
| <code><a href="#cdktn.SSHProvisionerConnection.property.timeout">timeout</a></code>                         | <code>str</code>                       | The timeout to wait for the connection to become available.                                             |
| <code><a href="#cdktn.SSHProvisionerConnection.property.user">user</a></code>                               | <code>str</code>                       | The user to use for the connection.                                                                     |

***

### `host`<sup>Required</sup> <a name="host" id="cdktn.SSHProvisionerConnection.property.host" />

```python theme={null}
host: str
```

* *Type:* str

The address of the resource to connect to.

***

### `type`<sup>Required</sup> <a name="type" id="cdktn.SSHProvisionerConnection.property.type" />

```python theme={null}
type: str
```

* *Type:* str

The connection type.

Valid values are "ssh" and "winrm".
Provisioners typically assume that the remote system runs Microsoft Windows when using WinRM.
Behaviors based on the SSH target\_platform will force Windows-specific behavior for WinRM, unless otherwise specified.

***

### `agent`<sup>Optional</sup> <a name="agent" id="cdktn.SSHProvisionerConnection.property.agent" />

```python theme={null}
agent: str
```

* *Type:* str

Set to false to disable using ssh-agent to authenticate.

On Windows the only supported SSH authentication agent is Pageant.

***

### `agent_identity`<sup>Optional</sup> <a name="agent_identity" id="cdktn.SSHProvisionerConnection.property.agentIdentity" />

```python theme={null}
agent_identity: str
```

* *Type:* str

The preferred identity from the ssh agent for authentication.

***

### `bastion_certificate`<sup>Optional</sup> <a name="bastion_certificate" id="cdktn.SSHProvisionerConnection.property.bastionCertificate" />

```python theme={null}
bastion_certificate: str
```

* *Type:* str

The contents of a signed CA Certificate.

The certificate argument must be used in conjunction with a bastion\_private\_key.
These can be loaded from a file on disk using the the file function.

***

### `bastion_host`<sup>Optional</sup> <a name="bastion_host" id="cdktn.SSHProvisionerConnection.property.bastionHost" />

```python theme={null}
bastion_host: str
```

* *Type:* str

Setting this enables the bastion Host connection.

The provisioner will connect to bastion\_host first, and then connect from there to host.

***

### `bastion_host_key`<sup>Optional</sup> <a name="bastion_host_key" id="cdktn.SSHProvisionerConnection.property.bastionHostKey" />

```python theme={null}
bastion_host_key: str
```

* *Type:* str

The public key from the remote host or the signing CA, used to verify the host connection.

***

### `bastion_password`<sup>Optional</sup> <a name="bastion_password" id="cdktn.SSHProvisionerConnection.property.bastionPassword" />

```python theme={null}
bastion_password: str
```

* *Type:* str

The password to use for the bastion host.

***

### `bastion_port`<sup>Optional</sup> <a name="bastion_port" id="cdktn.SSHProvisionerConnection.property.bastionPort" />

```python theme={null}
bastion_port: typing.Union[int, float]
```

* *Type:* typing.Union\[int, float]

The port to use connect to the bastion host.

***

### `bastion_private_key`<sup>Optional</sup> <a name="bastion_private_key" id="cdktn.SSHProvisionerConnection.property.bastionPrivateKey" />

```python theme={null}
bastion_private_key: str
```

* *Type:* str

The contents of an SSH key file to use for the bastion host.

These can be loaded from a file on disk using the file function.

***

### `bastion_user`<sup>Optional</sup> <a name="bastion_user" id="cdktn.SSHProvisionerConnection.property.bastionUser" />

```python theme={null}
bastion_user: str
```

* *Type:* str

The user for the connection to the bastion host.

***

### `certificate`<sup>Optional</sup> <a name="certificate" id="cdktn.SSHProvisionerConnection.property.certificate" />

```python theme={null}
certificate: str
```

* *Type:* str

The contents of a signed CA Certificate.

The certificate argument must be used in conjunction with a private\_key.
These can be loaded from a file on disk using the the file function.

***

### `host_key`<sup>Optional</sup> <a name="host_key" id="cdktn.SSHProvisionerConnection.property.hostKey" />

```python theme={null}
host_key: str
```

* *Type:* str

The public key from the remote host or the signing CA, used to verify the connection.

***

### `password`<sup>Optional</sup> <a name="password" id="cdktn.SSHProvisionerConnection.property.password" />

```python theme={null}
password: str
```

* *Type:* str

The password to use for the connection.

***

### `port`<sup>Optional</sup> <a name="port" id="cdktn.SSHProvisionerConnection.property.port" />

```python theme={null}
port: typing.Union[int, float]
```

* *Type:* typing.Union\[int, float]
* *Default:* 22

The port to connect to.

***

### `private_key`<sup>Optional</sup> <a name="private_key" id="cdktn.SSHProvisionerConnection.property.privateKey" />

```python theme={null}
private_key: str
```

* *Type:* str

The contents of an SSH key to use for the connection.

These can be loaded from a file on disk using the file function.
This takes preference over password if provided.

***

### `proxy_host`<sup>Optional</sup> <a name="proxy_host" id="cdktn.SSHProvisionerConnection.property.proxyHost" />

```python theme={null}
proxy_host: str
```

* *Type:* str

Setting this enables the SSH over HTTP connection.

This host will be connected to first, and then the host or bastion\_host connection will be made from there.

***

### `proxy_port`<sup>Optional</sup> <a name="proxy_port" id="cdktn.SSHProvisionerConnection.property.proxyPort" />

```python theme={null}
proxy_port: typing.Union[int, float]
```

* *Type:* typing.Union\[int, float]

The port to use connect to the proxy host.

***

### `proxy_scheme`<sup>Optional</sup> <a name="proxy_scheme" id="cdktn.SSHProvisionerConnection.property.proxyScheme" />

```python theme={null}
proxy_scheme: str
```

* *Type:* str

The ssh connection also supports the following fields to facilitate connections by SSH over HTTP proxy.

***

### `proxy_user_name`<sup>Optional</sup> <a name="proxy_user_name" id="cdktn.SSHProvisionerConnection.property.proxyUserName" />

```python theme={null}
proxy_user_name: str
```

* *Type:* str

The username to use connect to the private proxy host.

This argument should be specified only if authentication is required for the HTTP Proxy server.

***

### `proxy_user_password`<sup>Optional</sup> <a name="proxy_user_password" id="cdktn.SSHProvisionerConnection.property.proxyUserPassword" />

```python theme={null}
proxy_user_password: str
```

* *Type:* str

The password to use connect to the private proxy host.

This argument should be specified only if authentication is required for the HTTP Proxy server.

***

### `script_path`<sup>Optional</sup> <a name="script_path" id="cdktn.SSHProvisionerConnection.property.scriptPath" />

```python theme={null}
script_path: str
```

* *Type:* str

The path used to copy scripts meant for remote execution.

Refer to [How Provisioners Execute Remote Scripts below for more details](https://developer.hashicorp.com/terraform/language/resources/provisioners/connection#how-provisioners-execute-remote-scripts)

***

### `target_platform`<sup>Optional</sup> <a name="target_platform" id="cdktn.SSHProvisionerConnection.property.targetPlatform" />

```python theme={null}
target_platform: str
```

* *Type:* str
* *Default:* unix

The target platform to connect to.

Valid values are "windows" and "unix".
If the platform is set to windows, the default script\_path is c:\windows\temp\terraform\_%RAND%.cmd, assuming the SSH default shell is cmd.exe.
If the SSH default shell is PowerShell, set script\_path to "c:/windows/temp/terraform\_%RAND%.ps1"

***

### `timeout`<sup>Optional</sup> <a name="timeout" id="cdktn.SSHProvisionerConnection.property.timeout" />

```python theme={null}
timeout: str
```

* *Type:* str
* *Default:* 5m

The timeout to wait for the connection to become available.

Should be provided as a string (e.g., "30s" or "5m".)

***

### `user`<sup>Optional</sup> <a name="user" id="cdktn.SSHProvisionerConnection.property.user" />

```python theme={null}
user: str
```

* *Type:* str
* *Default:* root

The user to use for the connection.

***
