Skip to content

Commit 597393c

Browse files
committed
Merge remote-tracking branch 'github/main' into kb_update
2 parents 6397ee1 + 3cf1ce4 commit 597393c

File tree

348 files changed

+6131
-3603
lines changed

Some content is hidden

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

348 files changed

+6131
-3603
lines changed

.github/copilot-instructions.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
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.
22

3-
4-
5-
63
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.
74

8-
95
Please see [README.md](../README.md) and the [CONTRIBUTING.md](../CONTRIBUTING.md) docs before getting started.
106

11-
127
# Workflow
138

149
## High-Level Problem Solving Strategy
@@ -57,27 +52,27 @@ Carefully read the issue and think hard about a plan to solve it before coding.
5752
- After each change, verify correctness by running relevant tests.
5853
- If tests fail, analyze failures and revise your patch.
5954
- Write additional tests if needed to capture important behaviors or edge cases.
60-
- Ensure all tests pass before finalizing.
55+
- NEVER accept acceptance tests that have been skipped due to environment issues; always ensure the environment is correctly set up and all tests run successfully.
6156

6257
### 6.1 Acceptance Testing Requirements
63-
When running acceptance tests (`make testacc`), ensure the following:
64-
58+
When running acceptance tests, ensure the following:
6559

6660
- **Environment Variables** - The following environment variables are required for acceptance tests:
6761
- `ELASTICSEARCH_ENDPOINTS` (default: http://localhost:9200)
6862
- `ELASTICSEARCH_USERNAME` (default: elastic)
6963
- `ELASTICSEARCH_PASSWORD` (default: password)
7064
- `KIBANA_ENDPOINT` (default: http://localhost:5601)
7165
- `TF_ACC` (must be set to "1" to enable acceptance tests)
72-
- **Ensure a valid environment if using `go test`** - Check if the required environment variables are set, if not use the defaults specified above.
73-
- **Always finish with `make testacc`** - This will run all tests. Make sure all tests pass before considering a task complete.
74-
- **Pre-set Environment Variables** - Default environment variables are configured in the Makefile. If these defaults are suitable for your testing environment, `make testacc` will work directly without additional setup
75-
- **Docker Environment** - For isolated testing with guaranteed environment setup, use `make docker-testacc` which starts Elasticsearch and Kibana containers automatically
66+
- **Run targeted tests using `go test`** - Ensure the required environment variables are explicitly defined when running targeted tests. Example:
67+
```bash
68+
ELASTICSEARCH_ENDPOINTS=http://localhost:9200 ELASTICSEARCH_USERNAME=elastic ELASTICSEARCH_PASSWORD=password KIBANA_ENDPOINT=http://localhost:5601 TF_ACC=1 go test -v -run TestAccResourceName ./path/to/testfile.go
69+
```
7670

7771
## 7. Final Verification
7872
- Confirm the root cause is fixed.
7973
- Review your solution for logic correctness and robustness.
8074
- Iterate until you are extremely confident the fix is complete and all tests pass.
75+
- Run the acceptance tests for any changed resources. Ensure acceptance tests pass without any environment-related skips. Use `make testacc` to verify this, explicitly defining the required environment variables.
8176
- Run `make lint` to ensure any linting errors have not surfaced with your changes. This task may automatically correct any linting errors, and regenerate documentation. Include any changes in your commit.
8277

8378
## 8. Final Reflection and Additional Testing

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
terraform_wrapper: false
4646

4747
- name: Lint
48-
run: make lint
48+
run: make check-lint
4949

5050
test:
5151
name: Matrix Acceptance Test

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
- Migrate `elasticstack_kibana_action_connector` to the Terraform plugin framework ([#1269](https://github.com/elastic/terraform-provider-elasticstack/pull/1269))
1414
- Migrate `elasticstack_elasticsearch_security_role_mapping` resource and data source to Terraform Plugin Framework ([#1279](https://github.com/elastic/terraform-provider-elasticstack/pull/1279))
1515
- Add support for `inactivity_timeout` in `elasticstack_fleet_agent_policy` ([#641](https://github.com/elastic/terraform-provider-elasticstack/issues/641))
16+
- Add support for `kafka` output types in `elasticstack_fleet_output` ([#1302](https://github.com/elastic/terraform-provider-elasticstack/pull/1302))
1617
- Add support for `prevent_initial_backfill` to `elasticstack_kibana_slo` ([#1071](https://github.com/elastic/terraform-provider-elasticstack/pull/1071))
1718
- [Refactor] Regenerate the SLO client using the current OpenAPI spec ([#1303](https://github.com/elastic/terraform-provider-elasticstack/pull/1303))
1819
- Add support for `data_view_id` in the `elasticstack_kibana_slo` resource ([#1305](https://github.com/elastic/terraform-provider-elasticstack/pull/1305))
1920
- Add support for `unenrollment_timeout` in `elasticstack_fleet_agent_policy` ([#1169](https://github.com/elastic/terraform-provider-elasticstack/issues/1169))
21+
- Handle default value for `allow_restricted_indices` in `elasticstack_elasticsearch_security_api_key` ([#1315](https://github.com/elastic/terraform-provider-elasticstack/pull/1315))
2022

2123
## [0.11.17] - 2025-07-21
2224

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ build-ci: ## build the terraform provider
5252
.PHONY: build
5353
build: lint build-ci ## build the terraform provider
5454

55-
5655
.PHONY: testacc
5756
testacc: ## Run acceptance tests
5857
TF_ACC=1 go test -v ./... -count $(ACCTEST_COUNT) -parallel $(ACCTEST_PARALLELISM) $(TESTARGS) -timeout $(ACCTEST_TIMEOUT)
@@ -225,7 +224,7 @@ docker-clean: ## Try to remove provisioned nodes and assigned network
225224

226225
.PHONY: docs-generate
227226
docs-generate: tools ## Generate documentation for the provider
228-
@ go tool github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-name elasticstack
227+
@ go tool github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-name terraform-provider-elasticstack
229228

230229

231230
.PHONY: gen
@@ -254,7 +253,10 @@ golangci-lint:
254253

255254

256255
.PHONY: lint
257-
lint: setup golangci-lint check-fmt check-docs ## Run lints to check the spelling and common go patterns
256+
lint: setup golangci-lint fmt docs-generate ## Run lints to check the spelling and common go patterns
257+
258+
.PHONY: check-lint
259+
check-lint: setup golangci-lint check-fmt check-docs
258260

259261
.PHONY: fmt
260262
fmt: ## Format code

docs/data-sources/elasticsearch_enrich_policy.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
12
---
2-
subcategory: "Enrich"
3+
# generated by https://github.com/hashicorp/terraform-plugin-docs
34
page_title: "elasticstack_elasticsearch_enrich_policy Data Source - terraform-provider-elasticstack"
5+
subcategory: "Enrich"
46
description: |-
5-
Returns information about an enrich policy. See: https://www.elastic.co/guide/en/elasticsearch/reference/current/get-enrich-policy-api.html
7+
Returns information about an enrich policy. See the enrich policy API documentation https://www.elastic.co/guide/en/elasticsearch/reference/current/get-enrich-policy-api.html for more details.
68
---
79

8-
# Data Source: elasticstack_elasticsearch_enrich_policy
10+
# elasticstack_elasticsearch_enrich_policy (Data Source)
911

10-
Returns information about an enrich policy. See: https://www.elastic.co/guide/en/elasticsearch/reference/current/get-enrich-policy-api.html
12+
Returns information about an enrich policy. See the [enrich policy API documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/get-enrich-policy-api.html) for more details.
1113

1214
## Example Usage
1315

docs/data-sources/elasticsearch_index_template.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
12
---
3+
# generated by https://github.com/hashicorp/terraform-plugin-docs
4+
page_title: "elasticstack_elasticsearch_index_template Data Source - terraform-provider-elasticstack"
25
subcategory: "Index"
3-
layout: ""
4-
page_title: "Elasticstack: elasticstack_elasticsearch_index_template Data Source"
56
description: |-
6-
Retrieves index template.
7+
Retrieves information about an existing index template definition. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-template.html
78
---
89

9-
# Data Source: elasticstack_elasticsearch_index_template
10+
# elasticstack_elasticsearch_index_template (Data Source)
1011

11-
Use this data source to retrieve information about existing Elasticsearch index templates. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-template.html
12+
Retrieves information about an existing index template definition. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-template.html
1213

1314
## Example Usage
1415

docs/data-sources/elasticsearch_indices.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
12
---
3+
# generated by https://github.com/hashicorp/terraform-plugin-docs
4+
page_title: "elasticstack_elasticsearch_indices Data Source - terraform-provider-elasticstack"
25
subcategory: "Index"
3-
layout: ""
4-
page_title: "Elasticstack: elasticstack_elasticsearch_indices Data Source"
56
description: |-
6-
Retrieves indices.
7+
Retrieves information about existing Elasticsearch indices. See: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-index.html
78
---
89

9-
# Data Source: elasticstack_elasticsearch_indices
10+
# elasticstack_elasticsearch_indices (Data Source)
1011

11-
Use this data source to retrieve and get information about existing Elasticsearch indices. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-index.html
12+
Retrieves information about existing Elasticsearch indices. See: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-index.html
1213

1314
## Example Usage
1415

docs/data-sources/elasticsearch_info.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
12
---
2-
subcategory: "Cluster"
3-
layout: ""
4-
page_title: "Elasticstack: elasticstack_elasticsearch_info Data Source"
3+
# generated by https://github.com/hashicorp/terraform-plugin-docs
4+
page_title: "elasticstack_elasticsearch_info Data Source - terraform-provider-elasticstack"
5+
subcategory: "Elasticsearch"
56
description: |-
6-
Gets information about the Elasticsearch cluster.
7+
Gets information about the Elastic cluster.
78
---
89

9-
# Data Source: elasticstack_elasticsearch_info
10+
# elasticstack_elasticsearch_info (Data Source)
1011

11-
This data source provides the information about the configured Elasticsearch cluster
12+
Gets information about the Elastic cluster.
1213

1314
## Example Usage
1415

docs/data-sources/elasticsearch_ingest_processor_append.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1+
12
---
3+
# generated by https://github.com/hashicorp/terraform-plugin-docs
4+
page_title: "elasticstack_elasticsearch_ingest_processor_append Data Source - terraform-provider-elasticstack"
25
subcategory: "Ingest"
3-
layout: ""
4-
page_title: "Elasticstack: elasticstack_elasticsearch_ingest_processor_append Data Source"
56
description: |-
6-
Helper data source to create a processor which appends one or more values to an existing array if the field already exists and it is an array.
7+
Helper data source which can be used to create the configuration for an append processor. This processor appends one or more values to an existing array if the field already exists and it is an array. Converts a scalar to an array and appends one or more values to it if the field exists and it is a scalar. Creates an array containing the provided values if the field doesn’t exist. See the append processor documentation https://www.elastic.co/guide/en/elasticsearch/reference/current/append-processor.html for more details.
78
---
89

9-
# Data Source: elasticstack_elasticsearch_ingest_processor_append
10-
11-
Helper data source to which can be used to create a processor to append one or more values to an existing array if the field already exists and it is an array.
12-
Converts a scalar to an array and appends one or more values to it if the field exists and it is a scalar. Creates an array containing the provided values if the field doesn’t exist.
10+
# elasticstack_elasticsearch_ingest_processor_append (Data Source)
1311

14-
See: https://www.elastic.co/guide/en/elasticsearch/reference/current/append-processor.html
12+
Helper data source which can be used to create the configuration for an append processor. This processor appends one or more values to an existing array if the field already exists and it is an array. Converts a scalar to an array and appends one or more values to it if the field exists and it is a scalar. Creates an array containing the provided values if the field doesn’t exist. See the [append processor documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/append-processor.html) for more details.
1513

1614
## Example Usage
1715

@@ -56,4 +54,3 @@ resource "elasticstack_elasticsearch_ingest_pipeline" "my_ingest_pipeline" {
5654

5755
- `id` (String) Internal identifier of the resource
5856
- `json` (String) JSON representation of this data source.
59-

docs/data-sources/elasticsearch_ingest_processor_bytes.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1+
12
---
3+
# generated by https://github.com/hashicorp/terraform-plugin-docs
4+
page_title: "elasticstack_elasticsearch_ingest_processor_bytes Data Source - terraform-provider-elasticstack"
25
subcategory: "Ingest"
3-
layout: ""
4-
page_title: "Elasticstack: elasticstack_elasticsearch_ingest_processor_bytes Data Source"
56
description: |-
6-
Helper data source to create a processor which converts a human readable byte value (e.g. 1kb) to its value in bytes (e.g. 1024).
7+
Helper data source which can be used to create the configuration for a bytes processor. The processor converts a human readable byte value (e.g. 1kb) to its value in bytes (e.g. 1024). See the bytes processor documentation https://www.elastic.co/guide/en/elasticsearch/reference/current/bytes-processor.html for more details.
8+
If the field is an array of strings, all members of the array will be converted.
9+
Supported human readable units are "b", "kb", "mb", "gb", "tb", "pb" case insensitive. An error will occur if the field is not a supported format or resultant value exceeds 2^63.
710
---
811

9-
# Data Source: elasticstack_elasticsearch_ingest_processor_bytes
12+
# elasticstack_elasticsearch_ingest_processor_bytes (Data Source)
1013

11-
Helper data source to which can be used to create a processor to convert a human readable byte value (e.g. 1kb) to its value in bytes (e.g. 1024). If the field is an array of strings, all members of the array will be converted.
14+
Helper data source which can be used to create the configuration for a bytes processor. The processor converts a human readable byte value (e.g. 1kb) to its value in bytes (e.g. 1024). See the [bytes processor documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/bytes-processor.html) for more details.
1215

13-
Supported human readable units are "b", "kb", "mb", "gb", "tb", "pb" case insensitive. An error will occur if the field is not a supported format or resultant value exceeds 2^63.
16+
If the field is an array of strings, all members of the array will be converted.
1417

15-
See: https://www.elastic.co/guide/en/elasticsearch/reference/current/bytes-processor.html
18+
Supported human readable units are "b", "kb", "mb", "gb", "tb", "pb" case insensitive. An error will occur if the field is not a supported format or resultant value exceeds 2^63.
1619

1720
## Example Usage
1821

@@ -55,4 +58,3 @@ resource "elasticstack_elasticsearch_ingest_pipeline" "my_ingest_pipeline" {
5558

5659
- `id` (String) Internal identifier of the resource
5760
- `json` (String) JSON representation of this data source.
58-

0 commit comments

Comments
 (0)