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

NameTypeDescription
bucketstr(Required) The name of the COS bucket.
acceleratebool(Optional) Whether to enable global Acceleration.
aclstr(Optional) Object ACL to be applied to the state file, allows private and public-read.
assume_roleCosBackendAssumeRole(Optional) The assume_role block.
domainstr(Optional) The root domain of the API request.
encryptbool(Optional) Whether to enable server side encryption of the state file.
endpointstr(Optional) The Custom Endpoint for the COS backend.
keystr(Optional) The path for saving the state file in bucket.
prefixstr(Optional) The directory for saving the state file in bucket.
regionstr(Optional) The region of the COS bucket.
secret_idstr(Optional) Secret id of Tencent Cloud.
secret_keystr(Optional) Secret key of Tencent Cloud.
security_tokenstr(Optional) TencentCloud Security Token of temporary access credentials.

bucketRequired

bucket: str
  • Type: str
(Required) The name of the COS bucket. You shall manually create it first.

accelerateOptional

accelerate: bool
  • Type: bool
(Optional) Whether to enable global Acceleration. Defaults to false.

aclOptional

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

assume_roleOptional

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

domainOptional

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

encryptOptional

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.

endpointOptional

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

keyOptional

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

prefixOptional

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

regionOptional

region: str
  • Type: str
(Optional) The region of the COS bucket. It supports environment variables TENCENTCLOUD_REGION.

secret_idOptional

secret_id: str
  • Type: str
(Optional) Secret id of Tencent Cloud. It supports environment variables TENCENTCLOUD_SECRET_ID.

secret_keyOptional

secret_key: str
  • Type: str
(Optional) Secret key of Tencent Cloud. It supports environment variables TENCENTCLOUD_SECRET_KEY.

security_tokenOptional

security_token: str
  • Type: str
(Optional) TencentCloud Security Token of temporary access credentials. It supports environment variables TENCENTCLOUD_SECURITY_TOKEN.