Skip to content

Commit 5ddcf0e

Browse files
committed
Merge branch 'main' of github.com:elastic/terraform-provider-elasticstack into add_security_exception_list
2 parents ef69978 + 0570ebd commit 5ddcf0e

File tree

70 files changed

+9452
-5419
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+9452
-5419
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ FLEET_CONTAINER_NAME=terraform-elasticstack-fleet
1515
ACCEPTANCE_TESTS_CONTAINER_NAME=terraform-elasticstack-acceptance-tests
1616
TOKEN_ACCEPTANCE_TESTS_CONTAINER_NAME=terraform-elasticstack-token-acceptance-tests
1717
GOVERSION=1.25.1
18+
TF_ELASTICSTACK_INCLUDE_EXPERIMENTAL=true

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
You will be writing or reviewing code for the Terraform provider for Elastic Stack (Elasticsearch, Kibana, Fleet, APM, and Logstash). This is a Go-based repository hosting the provider source.
22

3-
When writing code, you must adhere to the coding standards and conventions outlined in the [CODING_STANDARDS.md](../CODING_STANDARDS.md) document in this repository.
3+
When writing code, you must adhere to the coding standards and conventions outlined in the [CODING_STANDARDS.md](../CODING_STANDARDS.md) document in this repository. After completing any code changes check again that they conform to the [CODING_STANDARDS.md](../CODING_STANDARDS.md).
44

55
When reviewing code, ensure that all changes comply with the coding standards and conventions specified in the [CODING_STANDARDS.md](../CODING_STANDARDS.md) document. Pay special attention to project structure, schema definitions, JSON handling, resource implementation, and testing practices.
66

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
ELASTIC_PASSWORD: password
5656
KIBANA_SYSTEM_USERNAME: kibana_system
5757
KIBANA_SYSTEM_PASSWORD: password
58+
TF_ELASTICSTACK_INCLUDE_EXPERIMENTAL: true
5859
services:
5960
elasticsearch:
6061
image: docker.elastic.co/elasticsearch/elasticsearch:${{ matrix.version }}

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ builds:
3131
goarch: '386'
3232
binary: '{{ .ProjectName }}_v{{ .Version }}'
3333
archives:
34-
- format: zip
34+
- formats: zip
3535
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
3636
checksum:
3737
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,48 @@
11
## [Unreleased]
22

3+
### Breaking changes
4+
5+
#### `elasticstack_elasticsearch_index.alias` block has changed to a set attribute.
6+
7+
The `alias` block in the `elasticstack_elasticsearch_index` resource has been moved to an attribute.
8+
This transition provides better support for future changes in both the provider and the underlying Terraform framework.
9+
10+
Existing usage of the `alias` block must be migrated to the attribute syntax. For example:
11+
12+
```hcl
13+
alias {
14+
name = "my_alias_1"
15+
}
16+
17+
alias {
18+
name = "my_alias_2"
19+
filter = jsonencode({
20+
term = { "user.id" = "developer" }
21+
})
22+
}
23+
```
24+
25+
becomes
26+
27+
```hcl
28+
alias = [
29+
{
30+
name = "my_alias_1"
31+
},
32+
{
33+
name = "my_alias_2"
34+
filter = jsonencode({
35+
term = { "user.id" = "developer" }
36+
})
37+
}
38+
]
39+
```
40+
41+
### Changes
42+
343
- Support `.bedrock` and `.gen-ai` connectors ([#1467](https://github.com/elastic/terraform-provider-elasticstack/pull/1467))
444
- Support the `solution` attribute in `elasticstack_kibana_space` from 8.16 ([#1486](https://github.com/elastic/terraform-provider-elasticstack/pull/1486))
45+
- Add `elasticstack_elasticsearch_alias` resource ([#1343](https://github.com/elastic/terraform-provider-elasticstack/pull/1343))
546

647
## [0.12.2] - 2025-11-19
748
- Fix `elasticstack_elasticsearch_snapshot_lifecycle` metadata type conversion causing terraform apply to fail ([#1409](https://github.com/elastic/terraform-provider-elasticstack/issues/1409))

CODING_STANDARDS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ This document outlines the coding standards and conventions used in the terrafor
3636
- Prefer using existing util functions over longer form, duplicated code:
3737
- `utils.IsKnown(val)` instead of `!val.IsNull() && !val.IsUnknown()`
3838
- `utils.ListTypeAs` instead of `val.ElementsAs` or similar for other collection types
39+
- The final state for a resource should be derived from a read request following a mutative request (eg create or update). We should not use the response from a mutative request to build the final resource state.
3940

4041
## Schema Definitions
4142

docker-compose.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ services:
134134
ELASTICSEARCH_USERNAME: elastic
135135
ELASTICSEARCH_PASSWORD: ${ELASTICSEARCH_PASSWORD}
136136
TF_LOG: ${TF_LOG:-info}
137-
command: make testacc TESTARGS=${TESTARGS:-}
137+
TF_ELASTICSTACK_INCLUDE_EXPERIMENTAL: "true"
138+
command: make testacc TESTARGS='${TESTARGS:-}'
138139

139140
token-acceptance-tests:
140141
profiles: ["token-acceptance-tests"]

docs/resources/elasticsearch_index.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@ provider "elasticstack" {
2020
resource "elasticstack_elasticsearch_index" "my_index" {
2121
name = "my-index"
2222
23-
alias {
23+
alias = [{
2424
name = "my_alias_1"
25-
}
26-
27-
alias {
25+
}, {
2826
name = "my_alias_2"
2927
filter = jsonencode({
3028
term = { "user.id" = "developer" }
3129
})
32-
}
30+
}]
3331
3432
mappings = jsonencode({
3533
properties = {
@@ -59,7 +57,7 @@ resource "elasticstack_elasticsearch_index" "my_index" {
5957

6058
### Optional
6159

62-
- `alias` (Block Set) Aliases for the index. (see [below for nested schema](#nestedblock--alias))
60+
- `alias` (Attributes Set) Aliases for the index. (see [below for nested schema](#nestedatt--alias))
6361
- `analysis_analyzer` (String) A JSON string describing the analyzers applied to the index.
6462
- `analysis_char_filter` (String) A JSON string describing the char_filters applied to the index.
6563
- `analysis_filter` (String) A JSON string describing the filters applied to the index.
@@ -135,7 +133,7 @@ resource "elasticstack_elasticsearch_index" "my_index" {
135133
- `id` (String) Internal identifier of the resource
136134
- `settings_raw` (String) All raw settings fetched from the cluster.
137135

138-
<a id="nestedblock--alias"></a>
136+
<a id="nestedatt--alias"></a>
139137
### Nested Schema for `alias`
140138

141139
Required:
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "elasticstack_elasticsearch_index_alias Resource - terraform-provider-elasticstack"
4+
subcategory: "Index"
5+
description: |-
6+
Manages an Elasticsearch alias. See the alias documentation https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html for more details.
7+
---
8+
9+
# elasticstack_elasticsearch_index_alias (Resource)
10+
11+
Manages an Elasticsearch alias. See the [alias documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html) for more details.
12+
13+
14+
15+
<!-- schema generated by tfplugindocs -->
16+
## Schema
17+
18+
### Required
19+
20+
- `name` (String) The alias name.
21+
22+
### Optional
23+
24+
- `read_indices` (Attributes Set) Set of read indices for the alias. (see [below for nested schema](#nestedatt--read_indices))
25+
- `write_index` (Attributes) The write index for the alias. Only one write index is allowed per alias. (see [below for nested schema](#nestedatt--write_index))
26+
27+
### Read-Only
28+
29+
- `id` (String) Generated ID of the alias resource.
30+
31+
<a id="nestedatt--read_indices"></a>
32+
### Nested Schema for `read_indices`
33+
34+
Required:
35+
36+
- `name` (String) Name of the read index.
37+
38+
Optional:
39+
40+
- `filter` (String) Query used to limit documents the alias can access.
41+
- `index_routing` (String) Value used to route indexing operations to a specific shard.
42+
- `is_hidden` (Boolean) If true, the alias is hidden.
43+
- `routing` (String) Value used to route indexing and search operations to a specific shard.
44+
- `search_routing` (String) Value used to route search operations to a specific shard.
45+
46+
47+
<a id="nestedatt--write_index"></a>
48+
### Nested Schema for `write_index`
49+
50+
Required:
51+
52+
- `name` (String) Name of the write index.
53+
54+
Optional:
55+
56+
- `filter` (String) Query used to limit documents the alias can access.
57+
- `index_routing` (String) Value used to route indexing operations to a specific shard.
58+
- `is_hidden` (Boolean) If true, the alias is hidden.
59+
- `routing` (String) Value used to route indexing and search operations to a specific shard.
60+
- `search_routing` (String) Value used to route search operations to a specific shard.

examples/resources/elasticstack_elasticsearch_index/resource.tf

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ provider "elasticstack" {
55
resource "elasticstack_elasticsearch_index" "my_index" {
66
name = "my-index"
77

8-
alias {
8+
alias = [{
99
name = "my_alias_1"
10-
}
11-
12-
alias {
10+
}, {
1311
name = "my_alias_2"
1412
filter = jsonencode({
1513
term = { "user.id" = "developer" }
1614
})
17-
}
15+
}]
1816

1917
mappings = jsonencode({
2018
properties = {

0 commit comments

Comments
 (0)