Skip to content

[Bug] Data stream lifecycles on Elastic Cloud serverless can't be deleted #1289

@respondersGY

Description

@respondersGY

Describe the bug
Deleting the resource resource elasticstack_elasticsearch_data_stream_lifecycle is not possible with the Terraform provider. Nonethless, it is possible in the Kibana UI that uses the following API endpoint: api/index_management/delete_data_streams.

To Reproduce

resource "elasticstack_elasticsearch_index_template" "main" {
  name     = "test"
  priority = 500

  index_patterns = ["test*"]

  data_stream {}

  template { }
}

resource "elasticstack_elasticsearch_data_stream" "main" {
  name = "test"

  depends_on = [
    elasticstack_elasticsearch_index_template.main
  ]
}

resource "elasticstack_elasticsearch_data_stream_lifecycle" "main" {
  name               = "test"
  data_retention = null

  depends_on = [
    elasticstack_elasticsearch_data_stream.main,
  ]

The error:

Failed with: {"error":{"root_cause":[{"type":"api_not_available_exception","reason":"Request for uri
│ [/_data_stream/test/_lifecycle?expand_wildcards=open] with method [DELETE] exists but is not available when running
│ in serverless mode"}],"type":"api_not_available_exception","reason":"Request for uri
│ [/_data_stream/test/_lifecycle?expand_wildcards=open] with method [DELETE] exists but is not available when running
│ in serverless mode"},"status":410}

Expected behavior
The resource elasticstack_elasticsearch_data_stream_lifecycle is correctly deleted. In the same manner that this can be done in the Kibana UI (api/index_management/delete_data_streams).

If this is not possible due to API limitations, it should be documented that use of this resource requires a manual removal from the Terraform state when destroying the infrastructure (tf state rmelasticstack_elasticsearch_data_stream_lifecycle.main)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions