У Terraform есть замечательная возможность помечать компоненты политикой жизненного цикла предотвратительной
resource "aws_s3_bucket" "k8_state_bucket" {
bucket = "${var.name}-${var.env}-state-store"
acl = "private"
lifecycle {
prevent_destroy = true
}
Однако при запуске terraform destroy
появляется сообщение об ошибке
[BUCKET NAME]: [BUCKET NAME]: the plan would destroy this resource,
but it currently has lifecycle.prevent_destroy set to true.
To avoid this error and continue with the plan, either disable
lifecycle.prevent_destroy or adjust the scope of the plan using
the -target flag.
Как уничтожить все компоненты, кроме компонентов с тегом жизненного цикла?