Open tempoivo opened 1 month ago
This behaviour was intentional by the original author of this part of the code. It forces a 2 phased application for any action resulting in index deletion and IIRC mimics the behaviour on the GCP provider (and potentially others with similar attributes).
The intended workflow is:
terraform apply
with deletion_protection=true
deletion_protection
by terraform apply
with deletion_protection=false
and not changes forcing replacement
Clarify the intended workflow required to delete/replace indices managed with
deletion_protection=true
.Original issue
Describe the bug If you create an index initially with
deletion_protection = true
, you are unable to delete it after changing todeletion_protection = false
. It keeps returning:Error: cannot destroy index without setting deletion_protection=false and running terraform apply
Same behaviour if you initially create the index with
deletion_protection = false
; after you turn it totrue
, you are still able to delete the index without any error, which should be prevented.To Reproduce Steps to reproduce the behavior:
provider "elasticstack" { elasticsearch { endpoints = ["http://elastic01.internal:9200"] username = var.admin_username password = var.admin_password } }
resource "elasticstack_elasticsearch_index" "index-0001" { name = "index-0001"
deletion_protection = true
mappings = jsonencode({ properties = { field1 = { type = "date" } } })
number_of_shards = 1 number_of_replicas = 0 }
elasticstack_elasticsearch_index.index-0001: Destroying... [id=SAv5uMFYSA-prywrU6dE_g/index-0001] │ Error: cannot destroy index without setting deletion_protection=false and running
terraform apply