MiG*_*iGo 22 amazon-s3 amazon-web-services terraform
我想删除使用 terraform 创建的非空 s3 存储桶。我也使用了force_destroy=true选项,但我仍然明白
BucketNotEmpty: The bucket you tried to delete is not empty
status code: 409, request id: xxxx, host id: xxxxxxx
Run Code Online (Sandbox Code Playgroud)
存储桶也是使用force_destroy选项创建的:
resource "aws_s3_bucket" "pipelineartifactstore" {
bucket = "${var.prefix}-${var.namespace}-${var.stage}-pipeline-artifactstore"
acl = "private"
force_destroy = true
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
tags = var.default_tags
}
Run Code Online (Sandbox Code Playgroud)
小智 13
在启用加密或版本控制之前可能会添加一些对象,因此请尝试使用 AWS cli 清空存储桶:
aws s3 rm s3://bucket-name --recursive
Run Code Online (Sandbox Code Playgroud)
然后再次运行 Terraform apply。
我想这是针对 Codepipeline 的。
小智 9
最好的选择是按照以下步骤操作:
force_destroy = true到您的 S3 配置terraform applyterraform destroy。即使那里有数据,它也会被删除,然后存储桶也会被删除。| 归档时间: |
|
| 查看次数: |
32485 次 |
| 最近记录: |