Skip to content

Commit 7b00638

Browse files
committed
Merge remote-tracking branch 'origin/main' into copilot/fix-1330
* origin/main: (90 commits) Add resource to manage ML datafeed state (#1422) Extract agent policy test config (#1439) chore(deps): update golang:1.25.4 docker digest to e68f6a0 (#1437) chore(deps): update kibana-openapi-spec digest to 6a867d8 (#1435) chore(deps): update docker.elastic.co/kibana/kibana docker tag to v9.2.1 (#1434) chore(deps): update docker.elastic.co/elasticsearch/elasticsearch docker tag to v9.2.1 (#1433) First take at documented coding standards (#1429) chore(deps): update golangci/golangci-lint-action action to v9 (#1431) chore(deps): update golang:1.25.4 docker digest to 6ca9eb0 (#1432) chore(deps): update kibana-openapi-spec digest to 96ffcd7 (#1430) chore(deps): update kibana-openapi-spec digest to a8e3b64 (#1428) chore(deps): update golang docker tag to v1.25.4 (#1423) Update the system_user acceptance tests to utilise the config directory pattern (#1404) Add an issue template for covering new stack features (#1418) chore(deps): update golang:1.25.3 docker digest to 6d4e5e7 (#1421) Update provider description (#1405) chore(deps): update golang:1.25.3 docker digest to 0afe9b5 (#1416) chore(deps): update module github.com/golangci/golangci-lint to v2.6.1 (#1417) Added space awareness to Agent Policies (#1390) Fix data view color field format params not computed in Terraform state (#1414) ...
2 parents cef94b5 + 8f45626 commit 7b00638

File tree

361 files changed

+49211
-4343
lines changed

Some content is hidden

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

361 files changed

+49211
-4343
lines changed

.buildkite/hooks/pre-command

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
set -euo pipefail
44

5+
if [[ "${BUILDKITE_PIPELINE_SLUG}" != "terraform-provider-elasticstack-release" ]]; then
6+
echo "Skipping pre-command hook for non-release pipeline"
7+
exit 0
8+
fi
9+
510
RELEASE_VAULT_PATH=kv/ci-shared/terraform-providers
611

712
if [[ "$BUILDKITE_PIPELINE_SLUG" == "terraform-provider-elasticstack-release" ]]; then

.buildkite/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
steps:
22
- label: Release
33
agents:
4-
image: "golang:1.25.1@sha256:8305f5fa8ea63c7b5bc85bd223ccc62941f852318ebfbd22f53bbd0b358c07e1"
4+
image: "golang:1.25.4@sha256:e68f6a00e88586577fafa4d9cefad1349c2be70d21244321321c407474ff9bf2"
55
cpu: "16"
66
memory: "24G"
77
ephemeralStorage: "20G"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
source /etc/profile.d/go.sh
6+
7+
echo "--- Regenerating the Kibana client"
8+
make -C generated/kbapi all
9+
10+
echo "--- Building the provider"
11+
make build
12+
13+
echo "--- Starting Stack containers"
14+
make docker-fleet
15+
16+
echo "--- Collecting docker info"
17+
docker ps
18+
docker logs terraform-elasticstack-kb 2>&1 > kibana.log
19+
docker logs terraform-elasticstack-es 2>&1 > es.log
20+
docker logs terraform-elasticstack-fleet 2>&1 > fleet.log
21+
22+
buildkite-agent artifact upload kibana.log
23+
buildkite-agent artifact upload es.log
24+
buildkite-agent artifact upload fleet.log
25+
26+
echo "--- Running acceptance tests"
27+
ELASTICSEARCH_ENDPOINTS=http://localhost:9200 KIBANA_ENDPOINT=http://localhost:5601 ELASTICSEARCH_USERNAME=elastic ELASTICSEARCH_PASSWORD=password make testacc
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
agents:
2+
provider: "gcp"
3+
machineType: "n1-standard-4"
4+
image: family/terraform-provider-elasticstack-ubuntu-2204
5+
steps:
6+
- label: Regenerate Kibana client and build provider
7+
command:
8+
- ".buildkite/scripts/update-kibana-client.sh"

.env

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
STACK_VERSION=9.1.5
2+
ELASTICSEARCH_CONTAINER_NAME=terraform-elasticstack-es
3+
ELASTICSEARCH_PASSWORD=password
4+
ELASTICSEARCH_PORT=9200
5+
ELASTICSEARCH_URL=http://localhost:${ELASTICSEARCH_PORT}
6+
ELASTICSEARCH_JAVA_OPTS="-Xms128m -Xmx1g"
7+
KIBANA_CONTAINER_NAME=terraform-elasticstack-kb
8+
KIBANA_SETTINGS_CONTAINER_NAME=terraform-elasticstack-kb-settings
9+
FLEET_SETTINGS_CONTAINER_NAME=terraform-elasticstack-fleet-settings
10+
KIBANA_CERTS_CONTAINER_NAME=terraform-elasticstack-kb-certs
11+
KIBANA_PORT=5601
12+
KIBANA_PASSWORD=password
13+
KIBANA_ENCRYPTION_KEY=GsRtLGKnnuvwVQ3lqSS5kGScdfpmgEDA
14+
FLEET_CONTAINER_NAME=terraform-elasticstack-fleet
15+
ACCEPTANCE_TESTS_CONTAINER_NAME=terraform-elasticstack-acceptance-tests
16+
TOKEN_ACCEPTANCE_TESTS_CONTAINER_NAME=terraform-elasticstack-token-acceptance-tests
17+
GOVERSION=1.25.1
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: New Stack functionality
2+
description: Add support for new Stack functionality
3+
title: "[FEATURE] <title>"
4+
labels: ["Feature", "Stack Led"]
5+
body:
6+
- type: input
7+
attributes:
8+
label: Name of the resource
9+
description: What is the name of the resource you are adding or extending?
10+
placeholder: "e.g elasticstack_elasticsearch_ml_datafeed"
11+
- type: textarea
12+
attributes:
13+
label: Describe new functionality
14+
description: A concise description of the new functionality to add.
15+
placeholder: |
16+
If you're extending an existing resource:
17+
* Describe any new fields, or changes to existing fields.
18+
* Reference the source code for the existing resource.
19+
* Describe any new cases that should be covered in acceptance testing.
20+
e.g:
21+
Add support for `query` field to the Machine Learning Datafeed resource.
22+
The code for the resource is in `internal/elasticsearch/ml/datafeed/`.
23+
Add new acceptance tests covering the new `query` field.
24+
25+
If you're adding an entirely new resource:
26+
* Describe the resource and its purpose.
27+
* Include links to relevant API documentation.
28+
* Describe where the resource code should live in the provider.
29+
* Describe any cases that should be covered in acceptance testing.
30+
e.g
31+
Add a new Machine Learning Datafeed resource to manage datafeeds for ML jobs.
32+
The new resource should live in `internal/elasticsearch/ml/datafeed/`.
33+
The resource will allow users to create, read, and delete ML datafeeds via the Elasticsearch API.
34+
API docs:
35+
- Create: https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-put-datafeed
36+
- Get: https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-get-datafeeds
37+
- Delete: https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-delete-datafeed
38+
Make sure acceptance tests cover both a basic datafeed, and thoroughly cover all attributes in the resource schema, including datafeeds filtered by the `query` attribute.
39+
validations:
40+
required: true
41+
- type: input
42+
attributes:
43+
label: Version Introduced
44+
description: What version of the Stack was this functionality introduced in?
45+
placeholder: "e.g 9.2.0"
46+
validations:
47+
required: true
48+
- type: textarea
49+
attributes:
50+
label: Anything else?
51+
placeholder: |
52+
Links? References? Anything that will give us more context about the functionality you're adding!
53+
54+
e.g:
55+
- Links to issues/PRs where this was added in Elasticsearch/Kibana etc.
56+
- Links to any relevant documentation.
57+
- Describe any dependencies or relationships to other resources (e.g an ML datafeed is linked to an anomaly detection job).
58+
- Describe any edge cases that should be covered in acceptance testing.
59+
validations:
60+
required: false

.github/copilot-instructions.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
You will be tasked to fix an issue from an open-source repository. This is a Go based repository hosting a Terrform provider for the elastic stack (elasticsearch and kibana) APIs. This repo currently supports both [plugin framework](https://developer.hashicorp.com/terraform/plugin/framework/getting-started/code-walkthrough) and [sdkv2](https://developer.hashicorp.com/terraform/plugin/sdkv2) resources. Unless you're told otherwise, all new resources _must_ use the plugin framework.
1+
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-
Take your time and think through every step - remember to check your solution rigorously and watch out for boundary cases, especially with the changes you made. Your solution must be perfect. If not, continue working on it. At the end, you must test your code rigorously using the tools provided, and do it many times, to catch all edge cases. If it is not robust, iterate more and make it perfect. Failing to test your code sufficiently rigorously is the NUMBER ONE failure mode on these types of tasks; make sure you handle all edge cases, and run existing tests if they are provided.
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.
4+
5+
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.
6+
7+
Take your time and think through every step - remember to check solutions rigorously and watch out for boundary cases, especially with the changes being made.
8+
9+
When writing code, your solution must be perfect. If not, continue working on it. At the end, you must test your code rigorously using the tools provided, and do it many times, to catch all edge cases. If it is not robust, iterate more and make it perfect. Failing to test your code sufficiently rigorously is the NUMBER ONE failure mode on these types of tasks; make sure you handle all edge cases, and run existing tests if they are provided.
410

511
Please see [README.md](../README.md) and the [CONTRIBUTING.md](../CONTRIBUTING.md) docs before getting started.
612

7-
# Workflow
13+
# Development Workflow
814

915
## High-Level Problem Solving Strategy
1016

.github/workflows/test.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
test:
5151
name: Matrix Acceptance Test
5252
needs: build
53-
runs-on: ubuntu-latest
53+
runs-on: ${{ matrix.runner == 'ubuntu-22.04' && 'ubuntu-22.04' || 'ubuntu-latest' }}
5454
env:
5555
ELASTIC_PASSWORD: password
5656
KIBANA_SYSTEM_USERNAME: kibana_system
@@ -63,14 +63,16 @@ jobs:
6363
xpack.security.enabled: true
6464
xpack.security.authc.api_key.enabled: true
6565
xpack.security.authc.token.enabled: true
66+
xpack.ml.use_auto_machine_memory_percent: true
67+
xpack.ml.max_model_memory_limit: 2g
6668
xpack.watcher.enabled: true
6769
xpack.license.self_generated.type: trial
6870
repositories.url.allowed_urls: https://example.com/*
6971
path.repo: /tmp
7072
ELASTIC_PASSWORD: ${{ env.ELASTIC_PASSWORD }}
7173
ports:
7274
- 9200:9200
73-
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
75+
options: --memory=2g --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
7476
kibana:
7577
image: docker.elastic.co/kibana/kibana:${{ matrix.version }}
7678
env:
@@ -108,11 +110,6 @@ jobs:
108110
matrix:
109111
version:
110112
- '7.17.13'
111-
- '8.0.1'
112-
- '8.1.3'
113-
- '8.2.3'
114-
- '8.3.3'
115-
- '8.4.3'
116113
- '8.5.3'
117114
- '8.6.2'
118115
- '8.7.1'
@@ -125,9 +122,22 @@ jobs:
125122
- '8.14.3'
126123
- '8.15.5'
127124
- '8.16.2'
128-
- '8.17.0'
129-
- '8.18.3'
130-
- '9.0.3'
125+
- '8.17.10'
126+
- '8.18.7'
127+
- '8.19.3'
128+
- '9.0.7'
129+
- '9.1.3'
130+
include:
131+
- version: '8.0.1'
132+
runner: ubuntu-22.04
133+
- version: '8.1.3'
134+
runner: ubuntu-22.04
135+
- version: '8.2.3'
136+
runner: ubuntu-22.04
137+
- version: '8.3.3'
138+
runner: ubuntu-22.04
139+
- version: '8.4.3'
140+
runner: ubuntu-22.04
131141
steps:
132142
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
133143
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6

CHANGELOG.md

Lines changed: 82 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,82 @@
11
## [Unreleased]
22

3+
- Fix `elasticstack_elasticsearch_snapshot_lifecycle` metadata type conversion causing terraform apply to fail ([#1409](https://github.com/elastic/terraform-provider-elasticstack/issues/1409))
4+
- Add new `elasticstack_elasticsearch_ml_anomaly_detection_job` resource ([#1329](https://github.com/elastic/terraform-provider-elasticstack/pull/1329))
5+
- Add new `elasticstack_elasticsearch_ml_datafeed` resource ([#1340](https://github.com/elastic/terraform-provider-elasticstack/pull/1340))
6+
- Add `space_ids` attribute to all Fleet resources to support space-aware Fleet resource management ([#1390](https://github.com/elastic/terraform-provider-elasticstack/pull/1390))
7+
- Add new `elasticstack_elasticsearch_ml_job_state` resource ([#1337](https://github.com/elastic/terraform-provider-elasticstack/pull/1337))
8+
- Add new `elasticstack_elasticsearch_ml_datafeed_state` resource ([#1422](https://github.com/elastic/terraform-provider-elasticstack/pull/1422))
9+
- Migrate `elasticstack_elasticsearch_security_role` resource to Terraform Plugin Framework ([#1330](https://github.com/elastic/terraform-provider-elasticstack/pull/1330))
10+
11+
12+
## [0.12.1] - 2025-10-22
13+
- Fix regression restricting the characters in an `elasticstack_elasticsearch_role_mapping` `name`. ([#1373](https://github.com/elastic/terraform-provider-elasticstack/pull/1373))
14+
- Add schema validations to require either (but not both) `index` and `data_view_id` is set for relevant Security Detection Rules ([#1381](https://github.com/elastic/terraform-provider-elasticstack/pull/1381))
15+
16+
## [0.12.0] - 2025-10-15
17+
18+
- Fix provider crash with `elasticstack_kibana_action_connector` when `config` or `secrets` was unset in 0.11.17 ([#1355](https://github.com/elastic/terraform-provider-elasticstack/pull/1355))
19+
- Added `labels` field to `elasticstack_kibana_synthetics_monitor` resource for associating key-value pairs with monitors ([#1360](https://github.com/elastic/terraform-provider-elasticstack/pull/1360))
20+
- Fixes provider crash with `elasticstack_kibana_slo` when using `kql_custom_indicator` with no `filter` set. ([#1354](https://github.com/elastic/terraform-provider-elasticstack/pull/1354))
21+
- Updates for Security Detection Rules ([#1361](https://github.com/elastic/terraform-provider-elasticstack/pull/1361)
22+
- Add support for `threat` property
23+
- Gracefully support `query` property not being set
24+
- Add esql specific validations to reject unsupported fields `index` and `filters`
25+
- Gracefully handle response action with no provided `frequency`
26+
- Add validation for required `anomaly_threshold` field in anomaly detection rules
27+
- Add support for `timeline_id` / `timeline_title` fields
28+
- Gracefully handle `threat_query` not being provided for `threat_match` ule
29+
30+
## [0.11.19] - 2025-10-22
31+
32+
Version 0.11.19 is equivalent to 0.12.1. It is being released to help mitigate impact from 0.11.18 being inadvertently released ahead of schedule. This version contained a breaking change and defects related to internal refactors. While 0.11.19 still contains a breaking change from 0.11.17 it does fix defects (see details below) for any users relying on the latest 0.11.x version.
33+
34+
- Fix regression restricting the characters in an `elasticstack_elasticsearch_role_mapping` `name`. ([#1373](https://github.com/elastic/terraform-provider-elasticstack/pull/1373))
35+
- Add schema validations to require either (but not both) `index` and `data_view_id` is set for relevant Security Detection Rules ([#1381](https://github.com/elastic/terraform-provider-elasticstack/pull/1381))
36+
- Fix provider crash with `elasticstack_kibana_action_connector` when `config` or `secrets` was unset in 0.11.17 ([#1355](https://github.com/elastic/terraform-provider-elasticstack/pull/1355))
37+
- Added `labels` field to `elasticstack_kibana_synthetics_monitor` resource for associating key-value pairs with monitors ([#1360](https://github.com/elastic/terraform-provider-elasticstack/pull/1360))
38+
- Fixes provider crash with `elasticstack_kibana_slo` when using `kql_custom_indicator` with no `filter` set. ([#1354](https://github.com/elastic/terraform-provider-elasticstack/pull/1354))
39+
- Updates for Security Detection Rules ([#1361](https://github.com/elastic/terraform-provider-elasticstack/pull/1361)
40+
- Add support for `threat` property
41+
- Gracefully support `query` property not being set
42+
- Add esql specific validations to reject unsupported fields `index` and `filters`
43+
- Gracefully handle response action with no provided `frequency`
44+
- Add validation for required `anomaly_threshold` field in anomaly detection rules
45+
- Add support for `timeline_id` / `timeline_title` fields
46+
- Gracefully handle `threat_query` not being provided for `threat_match` ule
47+
48+
## [0.11.18] - 2025-10-10
49+
50+
### Breaking changes
51+
52+
The `ssl` field on the `elasticstack_fleet_output` resource has been changes from a block to an attribute. This change ensures ongoing consistency within the resource schema for this resource, and aligns with Terraform best practices.
53+
54+
Existing `elasticstack_fleet_output` resources defining `ssl` will have to update the declaration to an attribute style. For example:
55+
56+
```hcl
57+
resource "elasticstack_fleet_output" "output" {
58+
...
59+
ssl {
60+
...
61+
}
62+
}
63+
```
64+
65+
becomes
66+
67+
```hcl
68+
resource "elasticstack_fleet_output" "output" {
69+
...
70+
ssl = { # Note the equals sign here.
71+
...
72+
}
73+
}
74+
```
75+
76+
### Changes
77+
78+
- Create `elasticstack_kibana_security_detection_rule` resource. ([#1290](https://github.com/elastic/terraform-provider-elasticstack/pull/1290))
79+
- Add `elasticstack_kibana_export_saved_objects` data source ([#1293](https://github.com/elastic/terraform-provider-elasticstack/pull/1293))
380
- Create `elasticstack_kibana_maintenance_window` resource. ([#1224](https://github.com/elastic/terraform-provider-elasticstack/pull/1224))
481
- Add support for `solution` field in `elasticstack_kibana_space` resource and data source ([#1102](https://github.com/elastic/terraform-provider-elasticstack/issues/1102))
582
- Add `slo_id` validation to `elasticstack_kibana_slo` ([#1221](https://github.com/elastic/terraform-provider-elasticstack/pull/1221))
@@ -21,7 +98,6 @@
2198
- Add support for `unenrollment_timeout` in `elasticstack_fleet_agent_policy` ([#1169](https://github.com/elastic/terraform-provider-elasticstack/issues/1169))
2299
- Handle default value for `allow_restricted_indices` in `elasticstack_elasticsearch_security_api_key` ([#1315](https://github.com/elastic/terraform-provider-elasticstack/pull/1315))
23100
- Fixed `nil` reference in kibana synthetics API client in case of response errors ([#1320](https://github.com/elastic/terraform-provider-elasticstack/pull/1320))
24-
- Migrate `elasticstack_elasticsearch_security_role` resource to Terraform Plugin Framework ([#1330](https://github.com/elastic/terraform-provider-elasticstack/pull/1330))
25101

26102
## [0.11.17] - 2025-07-21
27103

@@ -459,7 +535,11 @@
459535
- Initial set of docs
460536
- CI integration
461537
462-
[Unreleased]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.17...HEAD
538+
[Unreleased]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.12.1...HEAD
539+
[0.12.1]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.12.0...v0.12.1
540+
[0.12.0]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.18...v0.12.0
541+
[0.11.19]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.18...v0.11.19
542+
[0.11.18]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.17...v0.11.18
463543
[0.11.17]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.16...v0.11.17
464544
[0.11.16]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.15...v0.11.16
465545
[0.11.15]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.14...v0.11.15

0 commit comments

Comments
 (0)