Skip to main content
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

Initializer

import { CosBackendConfig } from 'cdktn'

const cosBackendConfig: CosBackendConfig = { ... }

Properties

NameTypeDescription
bucketstring(Required) The name of the COS bucket.
accelerateboolean(Optional) Whether to enable global Acceleration.
aclstring(Optional) Object ACL to be applied to the state file, allows private and public-read.
assumeRoleCosBackendAssumeRole(Optional) The assume_role block.
domainstring(Optional) The root domain of the API request.
encryptboolean(Optional) Whether to enable server side encryption of the state file.
endpointstring(Optional) The Custom Endpoint for the COS backend.
keystring(Optional) The path for saving the state file in bucket.
prefixstring(Optional) The directory for saving the state file in bucket.
regionstring(Optional) The region of the COS bucket.
secretIdstring(Optional) Secret id of Tencent Cloud.
secretKeystring(Optional) Secret key of Tencent Cloud.
securityTokenstring(Optional) TencentCloud Security Token of temporary access credentials.

bucketRequired

public readonly bucket: string;
  • Type: string
(Required) The name of the COS bucket. You shall manually create it first.

accelerateOptional

public readonly accelerate: boolean;
  • Type: boolean
(Optional) Whether to enable global Acceleration. Defaults to false.

aclOptional

public readonly acl: string;
  • Type: string
(Optional) Object ACL to be applied to the state file, allows private and public-read. Defaults to private.

assumeRoleOptional

public readonly assumeRole: CosBackendAssumeRole;
(Optional) The assume_role block. If provided, terraform will attempt to assume this role using the supplied credentials.

domainOptional

public readonly domain: string;
  • Type: string
(Optional) The root domain of the API request. Defaults to tencentcloudapi.com. It supports the environment variable TENCENTCLOUD_DOMAIN.

encryptOptional

public readonly encrypt: boolean;
  • Type: 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.

endpointOptional

public readonly endpoint: string;
  • Type: string
(Optional) The Custom Endpoint for the COS backend. It supports the environment variable TENCENTCLOUD_ENDPOINT.

keyOptional

public readonly key: string;
  • Type: string
(Optional) The path for saving the state file in bucket. Defaults to terraform.tfstate.

prefixOptional

public readonly prefix: string;
  • Type: string
(Optional) The directory for saving the state file in bucket. Default to “env:”.

regionOptional

public readonly region: string;
  • Type: string
(Optional) The region of the COS bucket. It supports environment variables TENCENTCLOUD_REGION.

secretIdOptional

public readonly secretId: string;
  • Type: string
(Optional) Secret id of Tencent Cloud. It supports environment variables TENCENTCLOUD_SECRET_ID.

secretKeyOptional

public readonly secretKey: string;
  • Type: string
(Optional) Secret key of Tencent Cloud. It supports environment variables TENCENTCLOUD_SECRET_KEY.

securityTokenOptional

public readonly securityToken: string;
  • Type: string
(Optional) TencentCloud Security Token of temporary access credentials. It supports environment variables TENCENTCLOUD_SECURITY_TOKEN.