Skip to content

Commit 04fcf34

Browse files
Copilottobio
andauthored
Add elasticstack_kibana_default_data_view resource to manage default data view (#1379)
* Initial plan * Add kibana_default_data_view resource with CRUD operations Co-authored-by: tobio <[email protected]> * Fix ID consistency and generate documentation Co-authored-by: tobio <[email protected]> * Add linting fixes, example, and final documentation Co-authored-by: tobio <[email protected]> * Make default data view API space aware * Support removing the default data view * Changelog * PR feedback --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: tobio <[email protected]> Co-authored-by: Toby Brain <[email protected]>
1 parent ae826d9 commit 04fcf34

File tree

20 files changed

+966
-277
lines changed

20 files changed

+966
-277
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ alias = [
4343
- Support `.bedrock` and `.gen-ai` connectors ([#1467](https://github.com/elastic/terraform-provider-elasticstack/pull/1467))
4444
- Support the `solution` attribute in `elasticstack_kibana_space` from 8.16 ([#1486](https://github.com/elastic/terraform-provider-elasticstack/pull/1486))
4545
- Add `elasticstack_elasticsearch_alias` resource ([#1343](https://github.com/elastic/terraform-provider-elasticstack/pull/1343))
46+
- Add `elasticstack_kibana_default_data_view` resource ([#1379](https://github.com/elastic/terraform-provider-elasticstack/pull/1379))
4647

4748
## [0.12.2] - 2025-11-19
4849
- Fix `elasticstack_elasticsearch_snapshot_lifecycle` metadata type conversion causing terraform apply to fail ([#1409](https://github.com/elastic/terraform-provider-elasticstack/issues/1409))
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "elasticstack_kibana_default_data_view Resource - terraform-provider-elasticstack"
4+
subcategory: "Kibana"
5+
description: |-
6+
Manages the default Kibana data view. See the Kibana Data Views API documentation https://www.elastic.co/docs/api/doc/kibana/v8/operation/operation-setdefaultdatailviewdefault for more information.
7+
---
8+
9+
# elasticstack_kibana_default_data_view (Resource)
10+
11+
Manages the default Kibana data view. See the [Kibana Data Views API documentation](https://www.elastic.co/docs/api/doc/kibana/v8/operation/operation-setdefaultdatailviewdefault) for more information.
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "elasticstack_elasticsearch_index" "my_index" {
17+
name = "my-index-000001"
18+
deletion_protection = false
19+
}
20+
21+
resource "elasticstack_kibana_data_view" "my_data_view" {
22+
data_view = {
23+
title = "my-index-*"
24+
name = "My Index Data View"
25+
}
26+
27+
depends_on = [elasticstack_elasticsearch_index.my_index]
28+
}
29+
30+
resource "elasticstack_kibana_default_data_view" "default" {
31+
data_view_id = elasticstack_kibana_data_view.my_data_view.data_view.id
32+
force = true
33+
skip_delete = false
34+
}
35+
```
36+
37+
<!-- schema generated by tfplugindocs -->
38+
## Schema
39+
40+
### Optional
41+
42+
- `data_view_id` (String) The data view identifier to set as default. NOTE: The API does not validate whether it is a valid identifier. Leave this unset (or explicitly `null`) to unset the default data view.
43+
- `force` (Boolean) Update an existing default data view identifier. If set to false and a default data view already exists, the operation will fail.
44+
- `skip_delete` (Boolean) If set to true, the default data view will not be unset when the resource is destroyed. The existing default data view will remain unchanged.
45+
- `space_id` (String) The Kibana space ID to set the default data view in. Defaults to `default`.
46+
47+
### Read-Only
48+
49+
- `id` (String) Internal identifier of the resource.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
resource "elasticstack_elasticsearch_index" "my_index" {
2+
name = "my-index-000001"
3+
deletion_protection = false
4+
}
5+
6+
resource "elasticstack_kibana_data_view" "my_data_view" {
7+
data_view = {
8+
title = "my-index-*"
9+
name = "My Index Data View"
10+
}
11+
12+
depends_on = [elasticstack_elasticsearch_index.my_index]
13+
}
14+
15+
resource "elasticstack_kibana_default_data_view" "default" {
16+
data_view_id = elasticstack_kibana_data_view.my_data_view.data_view.id
17+
force = true
18+
skip_delete = false
19+
}

0 commit comments

Comments
 (0)