> ## 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: ConsulBackend

> CDKTN Core API Reference for ConsulBackend in Python.

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

```python theme={null}
import cdktn

cdktn.ConsulBackend(
  scope: Construct,
  access_token: str,
  path: str,
  address: str = None,
  ca_file: str = None,
  cert_file: str = None,
  datacenter: str = None,
  gzip: bool = None,
  http_auth: str = None,
  key_file: str = None,
  lock: bool = None,
  scheme: str = None
)
```

| **Name**                                                                                        | **Type**                          | **Description**                                                                                                                        |
| ----------------------------------------------------------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| <code><a href="#cdktn.ConsulBackend.Initializer.parameter.scope">scope</a></code>               | <code>constructs.Construct</code> | *No description.*                                                                                                                      |
| <code><a href="#cdktn.ConsulBackend.Initializer.parameter.accessToken">access\_token</a></code> | <code>str</code>                  | (Required) Access token.                                                                                                               |
| <code><a href="#cdktn.ConsulBackend.Initializer.parameter.path">path</a></code>                 | <code>str</code>                  | (Required) Path in the Consul KV store.                                                                                                |
| <code><a href="#cdktn.ConsulBackend.Initializer.parameter.address">address</a></code>           | <code>str</code>                  | (Optional) DNS name and port of your Consul endpoint specified in the format dnsname:port.                                             |
| <code><a href="#cdktn.ConsulBackend.Initializer.parameter.caFile">ca\_file</a></code>           | <code>str</code>                  | (Optional) A path to a PEM-encoded certificate authority used to verify the remote agent's certificate.                                |
| <code><a href="#cdktn.ConsulBackend.Initializer.parameter.certFile">cert\_file</a></code>       | <code>str</code>                  | (Optional) A path to a PEM-encoded certificate provided to the remote agent;                                                           |
| <code><a href="#cdktn.ConsulBackend.Initializer.parameter.datacenter">datacenter</a></code>     | <code>str</code>                  | (Optional) The datacenter to use.                                                                                                      |
| <code><a href="#cdktn.ConsulBackend.Initializer.parameter.gzip">gzip</a></code>                 | <code>bool</code>                 | (Optional) true to compress the state data using gzip, or false (the default) to leave it uncompressed.                                |
| <code><a href="#cdktn.ConsulBackend.Initializer.parameter.httpAuth">http\_auth</a></code>       | <code>str</code>                  | (Optional) HTTP Basic Authentication credentials to be used when communicating with Consul, in the format of either user or user:pass. |
| <code><a href="#cdktn.ConsulBackend.Initializer.parameter.keyFile">key\_file</a></code>         | <code>str</code>                  | (Optional) A path to a PEM-encoded private key, required if cert\_file is specified.                                                   |
| <code><a href="#cdktn.ConsulBackend.Initializer.parameter.lock">lock</a></code>                 | <code>bool</code>                 | (Optional) false to disable locking.                                                                                                   |
| <code><a href="#cdktn.ConsulBackend.Initializer.parameter.scheme">scheme</a></code>             | <code>str</code>                  | (Optional) Specifies what protocol to use when talking to the given address,either http or https.                                      |

***

### `scope`<sup>Required</sup> <a name="scope" id="cdktn.ConsulBackend.Initializer.parameter.scope" />

* *Type:* constructs.Construct

***

### `access_token`<sup>Required</sup> <a name="access_token" id="cdktn.ConsulBackend.Initializer.parameter.accessToken" />

* *Type:* str

(Required) Access token.

***

### `path`<sup>Required</sup> <a name="path" id="cdktn.ConsulBackend.Initializer.parameter.path" />

* *Type:* str

(Required) Path in the Consul KV store.

***

### `address`<sup>Optional</sup> <a name="address" id="cdktn.ConsulBackend.Initializer.parameter.address" />

* *Type:* str

(Optional) DNS name and port of your Consul endpoint specified in the format dnsname:port.

Defaults to the local agent HTTP listener.

***

### `ca_file`<sup>Optional</sup> <a name="ca_file" id="cdktn.ConsulBackend.Initializer.parameter.caFile" />

* *Type:* str

(Optional) A path to a PEM-encoded certificate authority used to verify the remote agent's certificate.

***

### `cert_file`<sup>Optional</sup> <a name="cert_file" id="cdktn.ConsulBackend.Initializer.parameter.certFile" />

* *Type:* str

(Optional) A path to a PEM-encoded certificate provided to the remote agent;

requires use of key\_file.

***

### `datacenter`<sup>Optional</sup> <a name="datacenter" id="cdktn.ConsulBackend.Initializer.parameter.datacenter" />

* *Type:* str

(Optional) The datacenter to use.

Defaults to that of the agent.

***

### `gzip`<sup>Optional</sup> <a name="gzip" id="cdktn.ConsulBackend.Initializer.parameter.gzip" />

* *Type:* bool

(Optional) true to compress the state data using gzip, or false (the default) to leave it uncompressed.

***

### `http_auth`<sup>Optional</sup> <a name="http_auth" id="cdktn.ConsulBackend.Initializer.parameter.httpAuth" />

* *Type:* str

(Optional) HTTP Basic Authentication credentials to be used when communicating with Consul, in the format of either user or user:pass.

***

### `key_file`<sup>Optional</sup> <a name="key_file" id="cdktn.ConsulBackend.Initializer.parameter.keyFile" />

* *Type:* str

(Optional) A path to a PEM-encoded private key, required if cert\_file is specified.

***

### `lock`<sup>Optional</sup> <a name="lock" id="cdktn.ConsulBackend.Initializer.parameter.lock" />

* *Type:* bool

(Optional) false to disable locking.

This defaults to true, but will require session permissions with Consul and
at least kv write permissions on \$path/.lock to perform locking.

***

### `scheme`<sup>Optional</sup> <a name="scheme" id="cdktn.ConsulBackend.Initializer.parameter.scheme" />

* *Type:* str

(Optional) Specifies what protocol to use when talking to the given address,either http or https.

SSL support can also be triggered by setting then environment variable CONSUL\_HTTP\_SSL to true.

***

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

| **Name**                                                                                                  | **Description**                                                                   |
| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| <code><a href="#cdktn.ConsulBackend.toString">to\_string</a></code>                                       | Returns a string representation of this construct.                                |
| <code><a href="#cdktn.ConsulBackend.with">with</a></code>                                                 | Applies one or more mixins to this construct.                                     |
| <code><a href="#cdktn.ConsulBackend.addOverride">add\_override</a></code>                                 | *No description.*                                                                 |
| <code><a href="#cdktn.ConsulBackend.overrideLogicalId">override\_logical\_id</a></code>                   | Overrides the auto-generated logical ID with a specific ID.                       |
| <code><a href="#cdktn.ConsulBackend.resetOverrideLogicalId">reset\_override\_logical\_id</a></code>       | Resets a previously passed logical Id to use the auto-generated logical id again. |
| <code><a href="#cdktn.ConsulBackend.toHclTerraform">to\_hcl\_terraform</a></code>                         | *No description.*                                                                 |
| <code><a href="#cdktn.ConsulBackend.toMetadata">to\_metadata</a></code>                                   | *No description.*                                                                 |
| <code><a href="#cdktn.ConsulBackend.toTerraform">to\_terraform</a></code>                                 | Adds this resource to the terraform JSON output.                                  |
| <code><a href="#cdktn.ConsulBackend.getRemoteStateDataSource">get\_remote\_state\_data\_source</a></code> | Creates a TerraformRemoteState resource that accesses this backend.               |

***

### `to_string` <a name="to_string" id="cdktn.ConsulBackend.toString" />

```python theme={null}
def to_string() -> str
```

Returns a string representation of this construct.

### `with` <a name="with" id="cdktn.ConsulBackend.with" />

```python theme={null}
def with(
  mixins: *IMixin
) -> IConstruct
```

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple `with()` calls if subsequent mixins should apply to added
constructs.

#### `mixins`<sup>Required</sup> <a name="mixins" id="cdktn.ConsulBackend.with.parameter.mixins" />

* *Type:* \*constructs.IMixin

The mixins to apply.

***

### `add_override` <a name="add_override" id="cdktn.ConsulBackend.addOverride" />

```python theme={null}
def add_override(
  path: str,
  value: typing.Any
) -> None
```

#### `path`<sup>Required</sup> <a name="path" id="cdktn.ConsulBackend.addOverride.parameter.path" />

* *Type:* str

***

#### `value`<sup>Required</sup> <a name="value" id="cdktn.ConsulBackend.addOverride.parameter.value" />

* *Type:* typing.Any

***

### `override_logical_id` <a name="override_logical_id" id="cdktn.ConsulBackend.overrideLogicalId" />

```python theme={null}
def override_logical_id(
  new_logical_id: str
) -> None
```

Overrides the auto-generated logical ID with a specific ID.

#### `new_logical_id`<sup>Required</sup> <a name="new_logical_id" id="cdktn.ConsulBackend.overrideLogicalId.parameter.newLogicalId" />

* *Type:* str

The new logical ID to use for this stack element.

***

### `reset_override_logical_id` <a name="reset_override_logical_id" id="cdktn.ConsulBackend.resetOverrideLogicalId" />

```python theme={null}
def reset_override_logical_id() -> None
```

Resets a previously passed logical Id to use the auto-generated logical id again.

### `to_hcl_terraform` <a name="to_hcl_terraform" id="cdktn.ConsulBackend.toHclTerraform" />

```python theme={null}
def to_hcl_terraform() -> typing.Any
```

### `to_metadata` <a name="to_metadata" id="cdktn.ConsulBackend.toMetadata" />

```python theme={null}
def to_metadata() -> typing.Any
```

### `to_terraform` <a name="to_terraform" id="cdktn.ConsulBackend.toTerraform" />

```python theme={null}
def to_terraform() -> typing.Any
```

Adds this resource to the terraform JSON output.

### `get_remote_state_data_source` <a name="get_remote_state_data_source" id="cdktn.ConsulBackend.getRemoteStateDataSource" />

```python theme={null}
def get_remote_state_data_source(
  scope: Construct,
  name: str,
  _fromstack: str
) -> TerraformRemoteState
```

Creates a TerraformRemoteState resource that accesses this backend.

#### `scope`<sup>Required</sup> <a name="scope" id="cdktn.ConsulBackend.getRemoteStateDataSource.parameter.scope" />

* *Type:* constructs.Construct

***

#### `name`<sup>Required</sup> <a name="name" id="cdktn.ConsulBackend.getRemoteStateDataSource.parameter.name" />

* *Type:* str

***

#### `_fromstack`<sup>Required</sup> <a name="_fromstack" id="cdktn.ConsulBackend.getRemoteStateDataSource.parameter._fromStack" />

* *Type:* str

***

## Static Functions <a name="Static Functions" id="Static Functions" />

| **Name**                                                                                  | **Description**               |
| ----------------------------------------------------------------------------------------- | ----------------------------- |
| <code><a href="#cdktn.ConsulBackend.isConstruct">is\_construct</a></code>                 | Checks if `x` is a construct. |
| <code><a href="#cdktn.ConsulBackend.isTerraformElement">is\_terraform\_element</a></code> | *No description.*             |
| <code><a href="#cdktn.ConsulBackend.isBackend">is\_backend</a></code>                     | *No description.*             |

***

### `is_construct` <a name="is_construct" id="cdktn.ConsulBackend.isConstruct" />

```python theme={null}
import cdktn

cdktn.ConsulBackend.is_construct(
  x: typing.Any
)
```

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct`
instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on
disk are seen as independent, completely different libraries. As a
consequence, the class `Construct` in each copy of the `constructs` library
is seen as a different class, and an instance of one class will not test as
`instanceof` the other class. `npm install` will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the `constructs`
library can be accidentally installed, and `instanceof` will behave
unpredictably. It is safest to avoid using `instanceof`, and using
this type-testing method instead.

#### `x`<sup>Required</sup> <a name="x" id="cdktn.ConsulBackend.isConstruct.parameter.x" />

* *Type:* typing.Any

Any object.

***

### `is_terraform_element` <a name="is_terraform_element" id="cdktn.ConsulBackend.isTerraformElement" />

```python theme={null}
import cdktn

cdktn.ConsulBackend.is_terraform_element(
  x: typing.Any
)
```

#### `x`<sup>Required</sup> <a name="x" id="cdktn.ConsulBackend.isTerraformElement.parameter.x" />

* *Type:* typing.Any

***

### `is_backend` <a name="is_backend" id="cdktn.ConsulBackend.isBackend" />

```python theme={null}
import cdktn

cdktn.ConsulBackend.is_backend(
  x: typing.Any
)
```

#### `x`<sup>Required</sup> <a name="x" id="cdktn.ConsulBackend.isBackend.parameter.x" />

* *Type:* typing.Any

***

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

| **Name**                                                                                       | **Type**                                                        | **Description**   |
| ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | ----------------- |
| <code><a href="#cdktn.ConsulBackend.property.node">node</a></code>                             | <code>constructs.Node</code>                                    | The tree node.    |
| <code><a href="#cdktn.ConsulBackend.property.cdktfStack">cdktf\_stack</a></code>               | <code><a href="#cdktn.TerraformStack">TerraformStack</a></code> | *No description.* |
| <code><a href="#cdktn.ConsulBackend.property.fqn">fqn</a></code>                               | <code>str</code>                                                | *No description.* |
| <code><a href="#cdktn.ConsulBackend.property.friendlyUniqueId">friendly\_unique\_id</a></code> | <code>str</code>                                                | *No description.* |

***

### `node`<sup>Required</sup> <a name="node" id="cdktn.ConsulBackend.property.node" />

```python theme={null}
node: Node
```

* *Type:* constructs.Node

The tree node.

***

### `cdktf_stack`<sup>Required</sup> <a name="cdktf_stack" id="cdktn.ConsulBackend.property.cdktfStack" />

```python theme={null}
cdktf_stack: TerraformStack
```

* *Type:* <a href="#cdktn.TerraformStack">TerraformStack</a>

***

### `fqn`<sup>Required</sup> <a name="fqn" id="cdktn.ConsulBackend.property.fqn" />

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

* *Type:* str

***

### `friendly_unique_id`<sup>Required</sup> <a name="friendly_unique_id" id="cdktn.ConsulBackend.property.friendlyUniqueId" />

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

* *Type:* str

***
