Skip to content

Commit 4c0dd71

Browse files
committed
Merge remote-tracking branch 'origin/main' into zero-replica-index
* origin/main: Add support for the `alert_delay` param in the Create Rule API (#715) chore: prepare release v0.11.6 (#716) Validate that mappings are a JSON object, not just valid json (#719) fix: move all resources in one namespace for tcp monitor acc tests (#717) Bump github.com/golangci/golangci-lint from 1.59.1 to 1.60.1 in /tools (#714) Bump github.com/docker/docker in /tools (#718) Bump github.com/goreleaser/goreleaser from 1.26.1 to 1.26.2 in /tools (#642) Bump github.com/hashicorp/terraform-plugin-framework (#705) Add kibana synthetics http and tcp monitor resources (#699) Kibana spaces data source (#682) Use ephemeral github token for build. (#712) chore: 8.15.0 is here - lets try it out (#708) Update changelog for 0.11.5 Bump version for 0.11.5 (#706) Bugfix SLO API: Update type for `group_by` to accept either string or array-of-strings (#701) Support `restriction` in `elasticstack_elasticsearch_security_api_key` (#577) chore: follow-up CR changes for synthetics private location resource (#697)
2 parents a7f722a + ffa5f17 commit 4c0dd71

File tree

184 files changed

+15895
-3616
lines changed

Some content is hidden

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

184 files changed

+15895
-3616
lines changed

.buildkite/hooks/pre-command

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "terraform-provider-elasticstack-release" ]]
1212
export GPG_PRIVATE_SECRET=$(scripts/retry.sh 5 vault kv get -field gpg_private ${RELEASE_VAULT_PATH})
1313
export GPG_PASSPHRASE_SECRET=$(scripts/retry.sh 5 vault kv get -field gpg_passphrase ${RELEASE_VAULT_PATH})
1414
export GPG_FINGERPRINT_SECRET=$(scripts/retry.sh 5 vault kv get -field gpg_fingerprint ${RELEASE_VAULT_PATH})
15-
export GITHUB_TOKEN=$(scripts/retry.sh 5 vault kv get -field gh_personal_access_token ${RELEASE_VAULT_PATH})
15+
export GITHUB_TOKEN="${VAULT_GITHUB_TOKEN}"
1616
fi

.github/workflows/test.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ jobs:
6060
image: docker.elastic.co/elasticsearch/elasticsearch:${{ matrix.version }}
6161
env:
6262
discovery.type: single-node
63-
xpack.license.self_generated.type: trial
6463
xpack.security.enabled: true
6564
xpack.security.authc.api_key.enabled: true
65+
xpack.security.authc.token.enabled: true
66+
xpack.security.http.ssl.enabled: false
6667
xpack.watcher.enabled: true
68+
xpack.license.self_generated.type: trial
6769
repositories.url.allowed_urls: https://example.com/*
6870
path.repo: /tmp
6971
ELASTIC_PASSWORD: ${{ env.ELASTIC_PASSWORD }}
@@ -78,9 +80,10 @@ jobs:
7880
ELASTICSEARCH_USERNAME: ${{ env.KIBANA_SYSTEM_USERNAME }}
7981
ELASTICSEARCH_PASSWORD: ${{ env.KIBANA_SYSTEM_PASSWORD }}
8082
XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: a7a6311933d3503b89bc2dbc36572c33a6c10925682e591bffcab6911c06786d
81-
xpack.fleet.enabled: true
83+
# LOGGING_ROOT_LEVEL: debug
8284
ports:
8385
- 5601:5601
86+
options: --health-cmd="curl http://localhost:5601/api/status" --health-interval=10s --health-timeout=5s --health-retries=10
8487

8588
timeout-minutes: 15
8689
strategy:
@@ -103,6 +106,7 @@ jobs:
103106
- '8.12.2'
104107
- '8.13.4'
105108
- '8.14.3'
109+
- '8.15.0'
106110
steps:
107111
- uses: actions/checkout@v4
108112
- uses: actions/setup-go@v5
@@ -134,6 +138,12 @@ jobs:
134138
ELASTICSEARCH_USERNAME: "elastic"
135139
ELASTICSEARCH_PASSWORD: ${{ env.ELASTIC_PASSWORD }}
136140

141+
- id: force-install-synthetics
142+
name: Force install synthetics
143+
if: matrix.version == '8.14.3' || matrix.version == '8.15.0'
144+
run: |-
145+
for i in {1..5}; do curl -s -H "Authorization: ApiKey ${{ steps.get-api-key.outputs.apikey }}" --header "Content-Type: application/json" --header "kbn-xsrf: true" --request POST --data '{ "force": true }' http://localhost:5601/api/fleet/epm/packages/synthetics/1.2.2 && break || sleep 15; done
146+
137147
- name: TF acceptance tests
138148
timeout-minutes: 10
139149
run: make testacc

CHANGELOG.md

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

3+
- Add the `alert_delay` field to the Create Rule API ([#715](https://github.com/elastic/terraform-provider-elasticstack/pull/715))
4+
5+
## [0.11.6] - 2024-08-20
6+
7+
- Improve validation for index settings and mappings ([#719](https://github.com/elastic/terraform-provider-elasticstack/pull/719))
8+
- Add support for Kibana synthetics http and tcp monitors ([#699](https://github.com/elastic/terraform-provider-elasticstack/pull/699))
9+
- Add `elasticstack_kibana_spaces` data source ([#682](https://github.com/elastic/terraform-provider-elasticstack/pull/682))
10+
11+
## [0.11.5] - 2024-08-12
12+
313
- Fix setting `id` for Fleet outputs and servers ([#666](https://github.com/elastic/terraform-provider-elasticstack/pull/666))
414
- Fix `elasticstack_fleet_enrollment_tokens` returning empty tokens in some case ([#683](https://github.com/elastic/terraform-provider-elasticstack/pull/683))
515
- Add support for Kibana synthetics private locations ([#696](https://github.com/elastic/terraform-provider-elasticstack/pull/696))
16+
- Support setting `restriction` in `elasticstack_elasticsearch_security_api_key` role definitions ([#577](https://github.com/elastic/terraform-provider-elasticstack/pull/577))
17+
- Fix type of `group_by` attribute in the `kibana_slo` resource to be compatible with versions 8.14+ ([#701](https://github.com/elastic/terraform-provider-elasticstack/pull/701))
618

719
## [0.11.4] - 2024-06-13
820

921
### Breaking changes
22+
1023
- The `title` attribute is now required in the elasticstack_kibana_data_view resource. In practice the resource didn't work without this set, the schema now enforces it's correctly configured.
1124

1225
### Fixed
@@ -31,7 +44,7 @@
3144

3245
### Added
3346

34-
- Added datasource for alerting connectors. ([#607](https://github.com/elastic/terraform-provider-elasticstack/pull/607))
47+
- Added datasource for alerting connectors. ([#607](https://github.com/elastic/terraform-provider-elasticstack/pull/607))
3548

3649
## [0.11.2] - 2024-03-13
3750

@@ -143,6 +156,7 @@
143156
- Add 'min\_\*' conditions to ILM rollover ([#250](https://github.com/elastic/terraform-provider-elasticstack/pull/250))
144157
- Add support for Kibana connections ([#226](https://github.com/elastic/terraform-provider-elasticstack/pull/226))
145158
- **[Breaking Change] Add 'deletion_protection' field to index resource** to avoid unintentional deletion. ([#167](https://github.com/elastic/terraform-provider-elasticstack/pull/167))
159+
146160
- To delete index resource, you'll need to explicitly set `deletion_protection = false` as follows.
147161

148162
```terraform
@@ -177,6 +191,7 @@
177191
- Correctly handle empty logstash pipeline metadata in plan diffs ([#256](https://github.com/elastic/terraform-provider-elasticstack/pull/256))
178192
- Fix error when logging API requests in debug mode ([#259](https://github.com/elastic/terraform-provider-elasticstack/pull/259))
179193
- **[Breaking Change] Change `pipeline_metadata` type from schema.TypeMap to schema.TypeString**. This is to fix an error caused by updates to Logstash Pipelines outside of TF ([#278](https://github.com/elastic/terraform-provider-elasticstack/issues/278))
194+
180195
- To use the updated `pipeline_metadata` field, you'll need to encapsulate any Terraform configuration with **jsonencode{}** as follows:
181196

182197
```terraform
@@ -202,6 +217,7 @@
202217
- run `terraform apply`
203218
- OR
204219
- reimport the resources into state using `terraform import` (<https://developer.hashicorp.com/terraform/cli/import>)
220+
205221
- Fix order of `indices` field in SLM ([#326](https://github.com/elastic/terraform-provider-elasticstack/pull/326))
206222
207223
## [0.5.0] - 2022-12-07
@@ -311,7 +327,9 @@
311327
- Initial set of docs
312328
- CI integration
313329
314-
[Unreleased]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.4...HEAD
330+
[Unreleased]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.6...HEAD
331+
[0.11.6]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.5...v0.11.6
332+
[0.11.5]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.4...v0.11.5
315333
[0.11.4]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.3...v0.11.4
316334
[0.11.3]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.2...v0.11.3
317335
[0.11.2]: https://github.com/elastic/terraform-provider-elasticstack/compare/v0.11.1...v0.11.2

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
.DEFAULT_GOAL = help
22
SHELL := /bin/bash
33

4-
VERSION ?= 0.11.4
4+
5+
VERSION ?= 0.11.6
56

67
NAME = elasticstack
78
BINARY = terraform-provider-${NAME}
@@ -15,14 +16,14 @@ SWAGGER_VERSION ?= 8.7
1516

1617
GOVERSION ?= $(shell grep -e '^go' go.mod | cut -f 2 -d ' ')
1718

18-
STACK_VERSION ?= 8.13.4
19+
STACK_VERSION ?= 8.15.0
1920

2021
ELASTICSEARCH_NAME ?= terraform-elasticstack-es
2122
ELASTICSEARCH_ENDPOINTS ?= http://$(ELASTICSEARCH_NAME):9200
2223
ELASTICSEARCH_USERNAME ?= elastic
2324
ELASTICSEARCH_PASSWORD ?= password
2425
ELASTICSEARCH_NETWORK ?= elasticstack-network
25-
ELASTICSEARCH_MEM ?= 1024m
26+
ELASTICSEARCH_MEM ?= 2048m
2627

2728
KIBANA_NAME ?= terraform-elasticstack-kb
2829
KIBANA_ENDPOINT ?= http://$(KIBANA_NAME):5601
@@ -131,7 +132,7 @@ docker-kibana: docker-network docker-elasticsearch set-kibana-password ## Start
131132
-e ELASTICSEARCH_USERNAME=$(KIBANA_SYSTEM_USERNAME) \
132133
-e ELASTICSEARCH_PASSWORD=$(KIBANA_SYSTEM_PASSWORD) \
133134
-e XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY=a7a6311933d3503b89bc2dbc36572c33a6c10925682e591bffcab6911c06786d \
134-
-e "logging.root.level=debug" \
135+
-e LOGGING_ROOT_LEVEL=debug \
135136
--name $(KIBANA_NAME) \
136137
--network $(ELASTICSEARCH_NETWORK) \
137138
docker.elastic.co/kibana/kibana:$(STACK_VERSION); \
@@ -156,7 +157,7 @@ docker-kibana-with-tls: docker-network docker-elasticsearch set-kibana-password
156157
-e SERVER_SSL_CERTIFICATE=/certs/localhost+1.pem \
157158
-e SERVER_SSL_KEY=/certs/localhost+1-key.pem \
158159
-e SERVER_SSL_ENABLED=true \
159-
-e "logging.root.level=debug" \
160+
-e LOGGING_ROOT_LEVEL=debug \
160161
--name $(KIBANA_NAME) \
161162
--network $(ELASTICSEARCH_NETWORK) \
162163
docker.elastic.co/kibana/kibana:$(STACK_VERSION); \
@@ -215,6 +216,7 @@ tools: $(GOBIN) ## Install useful tools for linting, docs generation and develop
215216
@ cd tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint
216217
@ cd tools && go install github.com/goreleaser/goreleaser
217218
@ cd tools && go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen
219+
@ cd tools && go install go.uber.org/mock/mockgen
218220

219221
.PHONY: misspell
220222
misspell:

docs/data-sources/kibana_spaces.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
subcategory: "Kibana"
3+
layout: ""
4+
page_title: "Elasticstack: elasticstack_kibana_spaces Data Source"
5+
description: |-
6+
Retrieve all Kibana spaces. See https://www.elastic.co/guide/en/kibana/master/spaces-api-get-all.html
7+
---
8+
9+
# Data Source: elasticstack_kibana_spaces
10+
11+
Use this data source to retrieve and get information about all existing Kibana spaces.
12+
13+
## Example Usage
14+
15+
```terraform
16+
provider "elasticstack" {
17+
elasticsearch {}
18+
kibana {}
19+
}
20+
21+
data "elasticstack_kibana_spaces" "all_spaces" {
22+
23+
}
24+
```
25+
26+
<!-- schema generated by tfplugindocs -->
27+
## Schema
28+
29+
### Read-Only
30+
31+
- `id` (String) Generated ID for the spaces.
32+
- `spaces` (Attributes List) The list of spaces. (see [below for nested schema](#nestedatt--spaces))
33+
34+
<a id="nestedatt--spaces"></a>
35+
### Nested Schema for `spaces`
36+
37+
Required:
38+
39+
- `name` (String) The display name for the space.
40+
41+
Optional:
42+
43+
- `description` (String) The description for the space.
44+
- `disabled_features` (List of String) The list of disabled features for the space. To get a list of available feature IDs, use the Features API (https://www.elastic.co/guide/en/kibana/master/features-api-get.html).
45+
- `image_url` (String) The data-URL encoded image to display in the space avatar.
46+
47+
Read-Only:
48+
49+
- `color` (String) The hexadecimal color code used in the space avatar. By default, the color is automatically generated from the space name.
50+
- `id` (String) Internal identifier of the resource.
51+
- `initials` (String) The initials shown in the space avatar. By default, the initials are automatically generated from the space name. Initials must be 1 or 2 characters.

docs/resources/elasticsearch_component_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ resource "elasticstack_elasticsearch_index_template" "my_template" {
6363
Optional:
6464

6565
- `alias` (Block Set) Alias to add. (see [below for nested schema](#nestedblock--template--alias))
66-
- `mappings` (String) Mapping for fields in the index.
66+
- `mappings` (String) Mapping for fields in the index. Should be specified as a JSON object of field mappings. See the documentation (https://www.elastic.co/guide/en/elasticsearch/reference/current/explicit-mapping.html) for more details
6767
- `settings` (String) Configuration options for the index. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings
6868

6969
<a id="nestedblock--template--alias"></a>

docs/resources/elasticsearch_index_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Optional:
102102
Optional:
103103

104104
- `alias` (Block Set) Alias to add. (see [below for nested schema](#nestedblock--template--alias))
105-
- `mappings` (String) Mapping for fields in the index.
105+
- `mappings` (String) Mapping for fields in the index. Should be specified as a JSON object of field mappings. See the documentation (https://www.elastic.co/guide/en/elasticsearch/reference/current/explicit-mapping.html) for more details
106106
- `settings` (String) Configuration options for the index. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules.html#index-modules-settings
107107

108108
<a id="nestedblock--template--alias"></a>

docs/resources/elasticsearch_security_api_key.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,37 @@ resource "elasticstack_elasticsearch_security_api_key" "api_key" {
4141
})
4242
}
4343
44+
# restriction on a role descriptor for an API key is supported since Elastic 8.9
45+
resource "elasticstack_elasticsearch_security_api_key" "api_key_with_restriction" {
46+
# Set the name
47+
name = "My API key"
48+
# Set the role descriptors
49+
role_descriptors = jsonencode({
50+
role-a = {
51+
cluster = ["all"],
52+
indices = [
53+
{
54+
names = ["index-a*"],
55+
privileges = ["read"]
56+
}
57+
],
58+
restriction = {
59+
workflows = ["search_application_query"]
60+
}
61+
}
62+
})
63+
64+
# Set the expiration for the API key
65+
expiration = "1d"
66+
67+
# Set the custom metadata for this user
68+
metadata = jsonencode({
69+
"env" = "testing"
70+
"open" = false
71+
"number" = 49
72+
})
73+
}
74+
4475
output "api_key" {
4576
value = elasticstack_elasticsearch_security_api_key.api_key
4677
sensitive = true

docs/resources/kibana_alerting_rule.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Could not create API key - Unsupported scheme "ApiKey" for granting API Key
6262
### Optional
6363

6464
- `actions` (Block List) An action that runs under defined conditions. (see [below for nested schema](#nestedblock--actions))
65+
- `alert_delay` (Number) A number that indicates how many consecutive runs need to meet the rule conditions for an alert to occur.
6566
- `enabled` (Boolean) Indicates if you want to run the rule on an interval basis.
6667
- `rule_id` (String) A UUID v1 or v4 to use instead of a randomly generated ID.
6768
- `space_id` (String) An identifier for the space. If space_id is not provided, the default space is used.

0 commit comments

Comments
 (0)