github.com/hugorut/terraform@v1.1.3/website/docs/language/settings/backends/cos.mdx (about)

     1  ---
     2  page_title: 'Backend Type: cos'
     3  description: >-
     4    Terraform can store the state remotely, making it easier to version and work
     5    with in a team.
     6  ---
     7  
     8  # COS
     9  
    10  Stores the state as an object in a configurable prefix in a given bucket on [Tencent Cloud Object Storage](https://intl.cloud.tencent.com/product/cos) (COS).
    11  
    12  This backend supports [state locking](/language/state/locking).
    13  
    14  ~> **Warning!** It is highly recommended that you enable [Object Versioning](https://intl.cloud.tencent.com/document/product/436/19883)
    15  on the COS bucket to allow for state recovery in the case of accidental deletions and human error.
    16  
    17  ## Example Configuration
    18  
    19  ```hcl
    20  terraform {
    21    backend "cos" {
    22      region = "ap-guangzhou"
    23      bucket = "bucket-for-terraform-state-1258798060"
    24      prefix = "terraform/state"
    25    }
    26  }
    27  ```
    28  
    29  This assumes we have a [COS Bucket](https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/resources/cos_bucket) created named `bucket-for-terraform-state-1258798060`,
    30  Terraform state will be written into the file `terraform/state/terraform.tfstate`.
    31  
    32  ## Data Source Configuration
    33  
    34  To make use of the COS remote state in another configuration, use the [`terraform_remote_state` data source](/language/state/remote-state-data).
    35  
    36  ```hcl
    37  data "terraform_remote_state" "foo" {
    38    backend = "cos"
    39  
    40    config = {
    41      region = "ap-guangzhou"
    42      bucket = "bucket-for-terraform-state-1258798060"
    43      prefix = "terraform/state"
    44    }
    45  }
    46  ```
    47  
    48  ## Configuration variables
    49  
    50  The following configuration options or environment variables are supported:
    51  
    52  - `secret_id` - (Optional) Secret id of Tencent Cloud. It supports environment variables `TENCENTCLOUD_SECRET_ID`.
    53  - `secret_key` - (Optional) Secret key of Tencent Cloud. It supports environment variables `TENCENTCLOUD_SECRET_KEY`.
    54  - `region` - (Optional) The region of the COS bucket. It supports environment variables `TENCENTCLOUD_REGION`.
    55  - `bucket` - (Required) The name of the COS bucket. You shall manually create it first.
    56  - `prefix` - (Optional) The directory for saving the state file in bucket. Default to "env:".
    57  - `key` - (Optional) The path for saving the state file in bucket. Defaults to `terraform.tfstate`.
    58  - `encrypt` - (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.
    59  - `acl` - (Optional) Object ACL to be applied to the state file, allows `private` and `public-read`. Defaults to `private`.