Skip to content

Commit b122f51

Browse files
[WIP] Upgrade to Elasticsearch 8.4.1 (#15)
* fix: migrate to es-handler instead to wrap all api call. Fix so many little bugs. Signed-off-by: langoureaux-s <sebastien.langoureaux@harmonie-mutuelle.fr> * feat: upgrade do elasticsearch 8.4.1 and add golangci-lint step Signed-off-by: langoureaux-s <sebastien.langoureaux@harmonie-mutuelle.fr> * fix: Add acctest form elasticsearch_data_stream ressource Signed-off-by: langoureaux-s <sebastien.langoureaux@harmonie-mutuelle.fr> * fix: Add forget tests and documentation Signed-off-by: langoureaux-s <sebastien.langoureaux@harmonie-mutuelle.fr> * fix: fix github workflow Signed-off-by: langoureaux-s <sebastien.langoureaux@harmonie-mutuelle.fr> * fix: bump to es-handler 8.0.2 Signed-off-by: langoureaux-s <sebastien.langoureaux@harmonie-mutuelle.fr> Signed-off-by: langoureaux-s <sebastien.langoureaux@harmonie-mutuelle.fr> Co-authored-by: langoureaux-s <sebastien.langoureaux@harmonie-mutuelle.fr>
1 parent dd57f51 commit b122f51

53 files changed

Lines changed: 1707 additions & 2278 deletions

File tree

Some content is hidden

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

.github/workflows/workflow.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,24 @@ jobs:
2222
- name: Setup Go
2323
uses: actions/setup-go@v2
2424
with:
25-
go-version: "1.17"
25+
go-version: "1.18"
2626
- name: Setup Elasticsearch
2727
run: |
2828
set -e
2929
docker-compose up &
3030
until $(curl --output /dev/null --silent --head --fail -u elastic:changeme http://localhost:9200); do sleep 5; done
3131
curl -XPOST -u elastic:changeme http://localhost:9200/_license/start_trial?acknowledge=true
32+
- name: golangci-lint
33+
uses: golangci/golangci-lint-action@v3
34+
with:
35+
version: latest
36+
args: --timeout 600s
3237
- name: Run build
3338
run: make build
3439
- name: Run acceptance tests
35-
run: ELASTICSEARCH_URLS="http://localhost:9200" ELASTICSEARCH_USERNAME="elastic" ELASTICSEARCH_PASSWORD="changeme" make testacc
40+
run: |
41+
mv es/resource_elasticsearch_license_test.go es/resource_elasticsearch_license_test.go.disable
42+
ELASTICSEARCH_URLS="http://localhost:9200" ELASTICSEARCH_USERNAME="elastic" ELASTICSEARCH_PASSWORD="changeme" make testacc
3643
- name: Run acceptance test on license resource
3744
run: |
3845
set -e
@@ -58,7 +65,7 @@ jobs:
5865
- name: Set up Go
5966
uses: actions/setup-go@v2
6067
with:
61-
go-version: 1.17
68+
go-version: 1.18
6269
- name: Import GPG key
6370
id: import_gpg
6471
uses: paultyng/ghaction-import-gpg@v2.1.0

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ gen:
1515
rm -f aws/internal/keyvaluetags/*_gen.go
1616
go generate ./...
1717

18-
test: fmtcheck
18+
test: fmt fmtcheck
1919
go test $(TEST) -timeout=30s -parallel=4
2020

2121
testacc: fmt fmtcheck
@@ -93,7 +93,7 @@ trial-license:
9393
curl -XPOST -u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} ${ELASTICSEARCH_URLS}/_license/start_trial?acknowledge=true
9494

9595
start-pods: clean-pods
96-
kubectl run elasticsearch --image docker.elastic.co/elasticsearch/elasticsearch:8.0.1 --port "9200" --expose --env "cluster.name=test" --env "discovery.type=single-node" --env "ELASTIC_PASSWORD=changeme" --env "xpack.security.enabled=true" --env "ES_JAVA_OPTS=-Xms512m -Xmx512m" --env "path.repo=/tmp" --limits "cpu=500m,memory=1024Mi"
96+
kubectl run elasticsearch --image docker.elastic.co/elasticsearch/elasticsearch:8.4.1 --port "9200" --expose --env "cluster.name=test" --env "discovery.type=single-node" --env "ELASTIC_PASSWORD=changeme" --env "xpack.security.enabled=true" --env "ES_JAVA_OPTS=-Xms512m -Xmx512m" --env "path.repo=/tmp" --limits "cpu=500m,memory=1024Mi"
9797
echo "Waiting for Elasticsearch availability"
9898
until curl -s http://elasticsearch:9200 | grep -q 'missing authentication credentials'; do sleep 30; done;
9999
echo "Enable trial license"

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: "3"
22

33
services:
44
elasticsearch:
5-
image: docker.elastic.co/elasticsearch/elasticsearch:8.0.1
5+
image: docker.elastic.co/elasticsearch/elasticsearch:8.4.1
66
hostname: elasticsearch
77
environment:
88
cluster.name: test

docs/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,6 @@ provider "elasticsearch" {
5151
- [elasticsearch_snapshot_repository](resources/elasticsearch_snapshot_repository.md)
5252
- [elasticsearch_snapshot_lifecycle_policy](resources/elasticsearch_snapshot_lifecycle_policy.md)
5353
- [elasticsearch_watcher](resources/elasticsearch_watcher.md)
54+
- [elasticsearch_data_stream](resources/elasticsearch_data_stream.md)
55+
- [elasticsearch_ingest_pipeline](resources/elasticsearch_ingest_pipeline.md)
56+
- [elasticsearch_transform](resources/elasticsearch_transform.md)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# elasticsearch_data_stream
2+
3+
This resource permit to manage the index data stream in Elasticsearch.
4+
You can see the API documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current/data-stream-apis.html
5+
6+
***Supported Elasticsearch version:***
7+
- v8
8+
9+
## Example Usage
10+
11+
It will create data stream index.
12+
13+
> You need to have index template with `data_sream` that match your index before to create data stream index.
14+
15+
```tf
16+
resource elasticsearch_data_stream "test" {
17+
name = "terraform-test"
18+
}
19+
```
20+
21+
## Argument Reference
22+
23+
***The following arguments are supported:***
24+
- **name**: (required) The data stream index name.
25+
26+
## Attribute Reference
27+
28+
NA

docs/resources/elasticsearch_index_component_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ You can see the API documentation: https://www.elastic.co/guide/en/elasticsearch
55

66
***Supported Elasticsearch version:***
77
- v7
8+
- v8
89

910
## Example Usage
1011

docs/resources/elasticsearch_index_lifecycle_policy.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ You can see the API documentation: https://www.elastic.co/guide/en/elasticsearch
66
***Supported Elasticsearch version:***
77
- v6
88
- v7
9+
- v8
910

1011
## Example Usage
1112

docs/resources/elasticsearch_index_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ You can see the API documentation: https://www.elastic.co/guide/en/elasticsearch
55

66
***Supported Elasticsearch version:***
77
- v7
8+
- v8
89

910
## Example Usage
1011

docs/resources/elasticsearch_index_template_legacy.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ You can see the API documentation: https://www.elastic.co/guide/en/elasticsearch
66
***Supported Elasticsearch version:***
77
- v6
88
- v7
9+
- v8
910

1011
## Example Usage
1112

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# elasticsearch_ingest_pipeline Resource Source
2+
3+
This resource permit to manage the ingest pipeline in Elasticsearch.
4+
You can see the API documentation: https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest-apis.html
5+
6+
***Supported Elasticsearch version:***
7+
- v8
8+
9+
## Example Usage
10+
11+
It will create ingest pipeline.
12+
13+
```tf
14+
resource elasticsearch_ingest_pipeline "test" {
15+
name = "terraform-test"
16+
pipeline = <<EOF
17+
{
18+
"description" : "My optional pipeline description",
19+
"processors" : [
20+
{
21+
"set" : {
22+
"description" : "My optional processor description",
23+
"field": "my-keyword-field",
24+
"value": "foo"
25+
}
26+
}
27+
]
28+
}
29+
EOF
30+
}
31+
```
32+
33+
## Argument Reference
34+
35+
***The following arguments are supported:***
36+
- **name**: (required) Identifier for the ingest pipeline.
37+
- **pipeline**: (required) The pipeline specification. It's a string as JSON object.
38+
39+
## Attribute Reference
40+
41+
NA

0 commit comments

Comments
 (0)