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

# Java: CosBackendConfig

> CDKTN Core API Reference for CosBackendConfig in Java.

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" />

```java theme={null}
import io.cdktn.cdktn.CosBackendConfig;

CosBackendConfig.builder()
    .bucket(java.lang.String)
//  .accelerate(java.lang.Boolean)
//  .acl(java.lang.String)
//  .assumeRole(CosBackendAssumeRole)
//  .domain(java.lang.String)
//  .encrypt(java.lang.Boolean)
//  .endpoint(java.lang.String)
//  .key(java.lang.String)
//  .prefix(java.lang.String)
//  .region(java.lang.String)
//  .secretId(java.lang.String)
//  .secretKey(java.lang.String)
//  .securityToken(java.lang.String)
    .build();
```

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

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

***

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

```java theme={null}
public java.lang.String getBucket();
```

* *Type:* java.lang.String

(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" />

```java theme={null}
public java.lang.Boolean getAccelerate();
```

* *Type:* java.lang.Boolean

(Optional) Whether to enable global Acceleration.

Defaults to false.

***

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

```java theme={null}
public java.lang.String getAcl();
```

* *Type:* java.lang.String

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

Defaults to private.

***

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

```java theme={null}
public CosBackendAssumeRole getAssumeRole();
```

* *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" />

```java theme={null}
public java.lang.String getDomain();
```

* *Type:* java.lang.String

(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" />

```java theme={null}
public java.lang.Boolean getEncrypt();
```

* *Type:* java.lang.Boolean

(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" />

```java theme={null}
public java.lang.String getEndpoint();
```

* *Type:* java.lang.String

(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" />

```java theme={null}
public java.lang.String getKey();
```

* *Type:* java.lang.String

(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" />

```java theme={null}
public java.lang.String getPrefix();
```

* *Type:* java.lang.String

(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" />

```java theme={null}
public java.lang.String getRegion();
```

* *Type:* java.lang.String

(Optional) The region of the COS bucket.

It supports environment variables TENCENTCLOUD\_REGION.

***

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

```java theme={null}
public java.lang.String getSecretId();
```

* *Type:* java.lang.String

(Optional) Secret id of Tencent Cloud.

It supports environment variables TENCENTCLOUD\_SECRET\_ID.

***

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

```java theme={null}
public java.lang.String getSecretKey();
```

* *Type:* java.lang.String

(Optional) Secret key of Tencent Cloud.

It supports environment variables TENCENTCLOUD\_SECRET\_KEY.

***

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

```java theme={null}
public java.lang.String getSecurityToken();
```

* *Type:* java.lang.String

(Optional) TencentCloud Security Token of temporary access credentials.

It supports environment variables TENCENTCLOUD\_SECURITY\_TOKEN.

***
