> ## 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.

# CSharp: ConsulBackendConfig

> CDKTN Core API Reference for ConsulBackendConfig in CSharp.

Stores the state in the Consul KV store at a given path. This backend supports state locking.

Read more about this backend in the Terraform docs:
[https://developer.hashicorp.com/terraform/language/settings/backends/consul](https://developer.hashicorp.com/terraform/language/settings/backends/consul)

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

```csharp theme={null}
using Io.Cdktn;

new ConsulBackendConfig {
    string AccessToken,
    string Path,
    string Address = null,
    string CaFile = null,
    string CertFile = null,
    string Datacenter = null,
    bool Gzip = null,
    string HttpAuth = null,
    string KeyFile = null,
    bool Lock = null,
    string Scheme = null
};
```

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

| **Name**                                                                               | **Type**            | **Description**                                                                                                                        |
| -------------------------------------------------------------------------------------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| <code><a href="#cdktn.ConsulBackendConfig.property.accessToken">AccessToken</a></code> | <code>string</code> | (Required) Access token.                                                                                                               |
| <code><a href="#cdktn.ConsulBackendConfig.property.path">Path</a></code>               | <code>string</code> | (Required) Path in the Consul KV store.                                                                                                |
| <code><a href="#cdktn.ConsulBackendConfig.property.address">Address</a></code>         | <code>string</code> | (Optional) DNS name and port of your Consul endpoint specified in the format dnsname:port.                                             |
| <code><a href="#cdktn.ConsulBackendConfig.property.caFile">CaFile</a></code>           | <code>string</code> | (Optional) A path to a PEM-encoded certificate authority used to verify the remote agent's certificate.                                |
| <code><a href="#cdktn.ConsulBackendConfig.property.certFile">CertFile</a></code>       | <code>string</code> | (Optional) A path to a PEM-encoded certificate provided to the remote agent;                                                           |
| <code><a href="#cdktn.ConsulBackendConfig.property.datacenter">Datacenter</a></code>   | <code>string</code> | (Optional) The datacenter to use.                                                                                                      |
| <code><a href="#cdktn.ConsulBackendConfig.property.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.ConsulBackendConfig.property.httpAuth">HttpAuth</a></code>       | <code>string</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.ConsulBackendConfig.property.keyFile">KeyFile</a></code>         | <code>string</code> | (Optional) A path to a PEM-encoded private key, required if cert\_file is specified.                                                   |
| <code><a href="#cdktn.ConsulBackendConfig.property.lock">Lock</a></code>               | <code>bool</code>   | (Optional) false to disable locking.                                                                                                   |
| <code><a href="#cdktn.ConsulBackendConfig.property.scheme">Scheme</a></code>           | <code>string</code> | (Optional) Specifies what protocol to use when talking to the given address,either http or https.                                      |

***

### `AccessToken`<sup>Required</sup> <a name="AccessToken" id="cdktn.ConsulBackendConfig.property.accessToken" />

```csharp theme={null}
public string AccessToken { get; set; }
```

* *Type:* string

(Required) Access token.

***

### `Path`<sup>Required</sup> <a name="Path" id="cdktn.ConsulBackendConfig.property.path" />

```csharp theme={null}
public string Path { get; set; }
```

* *Type:* string

(Required) Path in the Consul KV store.

***

### `Address`<sup>Optional</sup> <a name="Address" id="cdktn.ConsulBackendConfig.property.address" />

```csharp theme={null}
public string Address { get; set; }
```

* *Type:* string

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

Defaults to the local agent HTTP listener.

***

### `CaFile`<sup>Optional</sup> <a name="CaFile" id="cdktn.ConsulBackendConfig.property.caFile" />

```csharp theme={null}
public string CaFile { get; set; }
```

* *Type:* string

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

***

### `CertFile`<sup>Optional</sup> <a name="CertFile" id="cdktn.ConsulBackendConfig.property.certFile" />

```csharp theme={null}
public string CertFile { get; set; }
```

* *Type:* string

(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.ConsulBackendConfig.property.datacenter" />

```csharp theme={null}
public string Datacenter { get; set; }
```

* *Type:* string

(Optional) The datacenter to use.

Defaults to that of the agent.

***

### `Gzip`<sup>Optional</sup> <a name="Gzip" id="cdktn.ConsulBackendConfig.property.gzip" />

```csharp theme={null}
public bool Gzip { get; set; }
```

* *Type:* bool

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

***

### `HttpAuth`<sup>Optional</sup> <a name="HttpAuth" id="cdktn.ConsulBackendConfig.property.httpAuth" />

```csharp theme={null}
public string HttpAuth { get; set; }
```

* *Type:* string

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

***

### `KeyFile`<sup>Optional</sup> <a name="KeyFile" id="cdktn.ConsulBackendConfig.property.keyFile" />

```csharp theme={null}
public string KeyFile { get; set; }
```

* *Type:* string

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

***

### `Lock`<sup>Optional</sup> <a name="Lock" id="cdktn.ConsulBackendConfig.property.lock" />

```csharp theme={null}
public bool Lock { get; set; }
```

* *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.ConsulBackendConfig.property.scheme" />

```csharp theme={null}
public string Scheme { get; set; }
```

* *Type:* string

(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.

***
