tfstate file is stored locally in the current working directory by default. If computer damage causes file loss, all the resources corresponding to the tfstate file will become unmanageable, leading to a resource leak.tfstate file cannot be shared among team members.plan and apply on a remote server) in addition to the standard features.
terraform init to verify and configure the backend.tfstate file is stored in the local directory by default.backend block is nested in a top-level Terraform block. This document uses the Tencent Cloud Object Storage (COS) service as an example for configuration. For more information on other storage modes, see Available Backends.terraform {backend "cos" {region = "ap-nanjing"bucket = "tfstate-cos-1308126961"prefix = "terraform/state"}}
tfstate-cos-1308126961 bucket in COS, the Terraform state information will be written into the terraform/state/terraform.tfstate file as shown below:

フィードバック