

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 刪除堆疊集
<a name="cfct-delete-stack"></a>

如果您已在資訊清單檔案中啟用堆疊集刪除，則可以刪除堆疊集。依預設，`enable_stack_set_deletion` 參數設為 `false`。在此組態中，從 CfCT 資訊清單檔案移除資源時，不會採取任何動作來刪除相關聯的堆疊集。

如果您將資訊清單檔案中的 `enable_stack_set_deletion` 值變更為 `true` ，當您從資訊清單檔案移除相關聯的資源時，CfCT 會刪除堆疊集及其所有資源。

資訊清單檔案的 **v2** 支援此功能。

**重要**  
當您最初將 的值設定為 `enable_stack_set_deletion` `true`時，下次叫用 CfCT 時，**所有**以字首 開頭`CustomControlTower-`、具有關聯索引鍵標籤 `Key:AWS_Solutions, Value: CustomControlTowerStackSet`且未在資訊清單檔案中宣告的資源都會暫存以供刪除。

以下是如何在 `manifest.yaml` 檔案中設定此參數的範例：

```
version: 2021-03-15
region: us-east-1
enable_stack_set_deletion: true   #New opt-in functionality


resources: 
  - name: demo_resource_1
    resource_file: s3://demo_bucket/resource.template
    deployment_targets:
      accounts:
        - 012345678912
    deploy_method: stack_set
    ...
    regions:
    - us-east-1
    - us-west-2

  - name: demo_resource_2
    resource_file: s3://demo_bucket/resource.template
    deployment_targets:
      accounts:
        - 012345678912
    deploy_method: stack_set
    ...
    regions: 
    - us-east-1
    - eu-north-1
```