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

> CDKTN Core API Reference for CosBackendConfig in Python.

Stores the state as an object in a configurable prefix in a given bucket on Tencent Cloud Object Storage (COS).

This backend supports state locking.

Warning! It is highly recommended that you enable Object Versioning on the COS bucket to allow for state recovery in the case of accidental deletions and human error.

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

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

```python theme={null}
import cdktn

cdktn.CosBackendConfig(
  bucket: str,
  accelerate: bool = None,
  acl: str = None,
  assume_role: CosBackendAssumeRole = None,
  domain: str = None,
  encrypt: bool = None,
  endpoint: str = None,
  key: str = None,
  prefix: str = None,
  region: str = None,
  secret_id: str = None,
  secret_key: str = None,
  security_token: str = None
)
```

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

| **Name**                                                                                  | **Type**                                                                    | **Description**                                                                        |
| ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| <code><a href="#cdktn.CosBackendConfig.property.bucket">bucket</a></code>                 | <code>str</code>                                                            | (Required) The name of the COS bucket.                                                 |
| <code><a href="#cdktn.CosBackendConfig.property.accelerate">accelerate</a></code>         | <code>bool</code>                                                           | (Optional) Whether to enable global Acceleration.                                      |
| <code><a href="#cdktn.CosBackendConfig.property.acl">acl</a></code>                       | <code>str</code>                                                            | (Optional) Object ACL to be applied to the state file, allows private and public-read. |
| <code><a href="#cdktn.CosBackendConfig.property.assumeRole">assume\_role</a></code>       | <code><a href="#cdktn.CosBackendAssumeRole">CosBackendAssumeRole</a></code> | (Optional) The assume\_role block.                                                     |
| <code><a href="#cdktn.CosBackendConfig.property.domain">domain</a></code>                 | <code>str</code>                                                            | (Optional) The root domain of the API request.                                         |
| <code><a href="#cdktn.CosBackendConfig.property.encrypt">encrypt</a></code>               | <code>bool</code>                                                           | (Optional) Whether to enable server side encryption of the state file.                 |
| <code><a href="#cdktn.CosBackendConfig.property.endpoint">endpoint</a></code>             | <code>str</code>                                                            | (Optional) The Custom Endpoint for the COS backend.                                    |
| <code><a href="#cdktn.CosBackendConfig.property.key">key</a></code>                       | <code>str</code>                                                            | (Optional) The path for saving the state file in bucket.                               |
| <code><a href="#cdktn.CosBackendConfig.property.prefix">prefix</a></code>                 | <code>str</code>                                                            | (Optional) The directory for saving the state file in bucket.                          |
| <code><a href="#cdktn.CosBackendConfig.property.region">region</a></code>                 | <code>str</code>                                                            | (Optional) The region of the COS bucket.                                               |
| <code><a href="#cdktn.CosBackendConfig.property.secretId">secret\_id</a></code>           | <code>str</code>                                                            | (Optional) Secret id of Tencent Cloud.                                                 |
| <code><a href="#cdktn.CosBackendConfig.property.secretKey">secret\_key</a></code>         | <code>str</code>                                                            | (Optional) Secret key of Tencent Cloud.                                                |
| <code><a href="#cdktn.CosBackendConfig.property.securityToken">security\_token</a></code> | <code>str</code>                                                            | (Optional) TencentCloud Security Token of temporary access credentials.                |

***

### `bucket`<sup>Required</sup> <a name="bucket" id="cdktn.CosBackendConfig.property.bucket" />

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

* *Type:* str

(Required) The name of the COS bucket.

You shall manually create it first.

***

### `accelerate`<sup>Optional</sup> <a name="accelerate" id="cdktn.CosBackendConfig.property.accelerate" />

```python theme={null}
accelerate: bool
```

* *Type:* bool

(Optional) Whether to enable global Acceleration.

Defaults to false.

***

### `acl`<sup>Optional</sup> <a name="acl" id="cdktn.CosBackendConfig.property.acl" />

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

* *Type:* str

(Optional) Object ACL to be applied to the state file, allows private and public-read.

Defaults to private.

***

### `assume_role`<sup>Optional</sup> <a name="assume_role" id="cdktn.CosBackendConfig.property.assumeRole" />

```python theme={null}
assume_role: CosBackendAssumeRole
```

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

(Optional) The assume\_role block.

If provided, terraform will attempt to assume this role using the supplied credentials.

***

### `domain`<sup>Optional</sup> <a name="domain" id="cdktn.CosBackendConfig.property.domain" />

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

* *Type:* str

(Optional) The root domain of the API request.

Defaults to tencentcloudapi.com.
It supports the environment variable TENCENTCLOUD\_DOMAIN.

***

### `encrypt`<sup>Optional</sup> <a name="encrypt" id="cdktn.CosBackendConfig.property.encrypt" />

```python theme={null}
encrypt: bool
```

* *Type:* bool

(Optional) Whether to enable server side encryption of the state file.

If it is true, COS will use 'AES256' encryption algorithm to encrypt state file.

***

### `endpoint`<sup>Optional</sup> <a name="endpoint" id="cdktn.CosBackendConfig.property.endpoint" />

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

* *Type:* str

(Optional) The Custom Endpoint for the COS backend.

It supports the environment variable TENCENTCLOUD\_ENDPOINT.

***

### `key`<sup>Optional</sup> <a name="key" id="cdktn.CosBackendConfig.property.key" />

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

* *Type:* str

(Optional) The path for saving the state file in bucket.

Defaults to terraform.tfstate.

***

### `prefix`<sup>Optional</sup> <a name="prefix" id="cdktn.CosBackendConfig.property.prefix" />

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

* *Type:* str

(Optional) The directory for saving the state file in bucket.

Default to "env:".

***

### `region`<sup>Optional</sup> <a name="region" id="cdktn.CosBackendConfig.property.region" />

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

* *Type:* str

(Optional) The region of the COS bucket.

It supports environment variables TENCENTCLOUD\_REGION.

***

### `secret_id`<sup>Optional</sup> <a name="secret_id" id="cdktn.CosBackendConfig.property.secretId" />

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

* *Type:* str

(Optional) Secret id of Tencent Cloud.

It supports environment variables TENCENTCLOUD\_SECRET\_ID.

***

### `secret_key`<sup>Optional</sup> <a name="secret_key" id="cdktn.CosBackendConfig.property.secretKey" />

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

* *Type:* str

(Optional) Secret key of Tencent Cloud.

It supports environment variables TENCENTCLOUD\_SECRET\_KEY.

***

### `security_token`<sup>Optional</sup> <a name="security_token" id="cdktn.CosBackendConfig.property.securityToken" />

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

* *Type:* str

(Optional) TencentCloud Security Token of temporary access credentials.

It supports environment variables TENCENTCLOUD\_SECURITY\_TOKEN.

***
