Skip to content

Commit d0ad398

Browse files
authored
Merge branch 'main' into api-key-with-cross-cluster
2 parents 7969498 + 36f0b42 commit d0ad398

Some content is hidden

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

43 files changed

+6538
-12790
lines changed

.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.0@sha256:9e56f0d0f043a68bb8c47c819e47dc29f6e8f5129b8885bed9d43f058f7f3ed6"
4+
image: "golang:1.25.0@sha256:5502b0e56fca23feba76dbc5387ba59c593c02ccc2f0f7355871ea9a0852cebe"
55
cpu: "16"
66
memory: "24G"
77
ephemeralStorage: "20G"

.github/workflows/copilot-setup-steps.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- 9200:9200
4949
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
5050
kibana:
51-
image: docker.elastic.co/kibana/kibana:9.1.2@sha256:dea5d20df42e6833966deceadb10ecdbf85970b704d17b0abfc3b485622c1a08
51+
image: docker.elastic.co/kibana/kibana:9.1.3@sha256:26792c8e4a68ba0bff3efcc46755f60bf36bb16b2431014c210f2546ca1819ad
5252
env:
5353
SERVER_NAME: kibana
5454
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
@@ -79,7 +79,7 @@ jobs:
7979
options: --restart="unless-stopped"
8080

8181
steps:
82-
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
82+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
8383
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
8484
with:
8585
go-version-file: 'go.mod'

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
timeout-minutes: 5
2020
steps:
21-
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
21+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
2222
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
2323
with:
2424
go-version-file: 'go.mod'
@@ -34,7 +34,7 @@ jobs:
3434
name: Lint
3535
runs-on: ubuntu-latest
3636
steps:
37-
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
37+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
3838
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
3939
with:
4040
go-version-file: 'go.mod'
@@ -128,7 +128,7 @@ jobs:
128128
- '8.17.0'
129129
- '9.0.3'
130130
steps:
131-
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
131+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
132132
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
133133
with:
134134
go-version-file: 'go.mod'

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
- Add `ignore_missing_component_templates` to `elasticstack_elasticsearch_index_template` ([#1206](https://github.com/elastic/terraform-provider-elasticstack/pull/1206))
55
- Prevent provider panic when a script exists in state, but not in Elasticsearch ([#1218](https://github.com/elastic/terraform-provider-elasticstack/pull/1218))
66
- Add support for managing cross_cluster API keys in `elasticstack_elasticsearch_security_api_key` ([#1252](https://github.com/elastic/terraform-provider-elasticstack/pull/1252))
7+
- Allow version changes without a destroy/create cycle with `elasticstack_fleet_integration` ([#1255](https://github.com/elastic/terraform-provider-elasticstack/pull/1255)). This fixes an issue where it was impossible to upgrade integrations which are used by an integration policy.
8+
- Add `namespace` attribute to `elasticstack_kibana_synthetics_monitor` resource to support setting data stream namespace independently from `space_id` ([#1247](https://github.com/elastic/terraform-provider-elasticstack/pull/1247))
79

810
## [0.11.17] - 2025-07-21
911

CONTRIBUTING.md

Lines changed: 113 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,136 @@
1-
# Typical development workflow
1+
# Contributing
22

3-
Fork the repo, work on an issue
3+
This guide explains how to set up your environment, make changes, and submit a PR.
44

5-
## Updating the generated Kibana client.
5+
## Development Setup
66

7-
If your work involves the Kibana API, the endpoints may or may not be included in the generated client.
8-
Check [generated/kbapi](./generated/kbapi/) for more details.
7+
* Fork and clone the repo.
8+
* Setup your preferred IDE (IntelliJ, VSCode, etc.)
99

10-
## Acceptance tests
10+
Requirements:
11+
* [Terraform](https://www.terraform.io/downloads.html) >= 1.0.0
12+
* [Go](https://golang.org/doc/install) >= 1.25
13+
* Docker (for acceptance tests)
1114

12-
```bash
13-
make docker-testacc
14-
```
15+
## Development Workflow
1516

16-
Run a single test with terraform debug enabled:
17-
```bash
18-
env TF_LOG=DEBUG make docker-testacc TESTARGS='-run ^TestAccResourceDataStreamLifecycle$$'
19-
```
17+
* Create a new branch for your changes.
18+
* Make your changes. See [Useful Commands](#useful-commands) and [Debugging](#running--debugging-the-provider).
19+
* Validate your changes
20+
* Run unit and acceptance tests (See [Running Acceptance Tests](#running-acceptance-tests)).
21+
* Run `make lint` to check linting and formatting. For this check to succeed, all changes must have been committed.
22+
* All checks also run automatically on every PR.
23+
* Submit your PR for review.
24+
* Add a changelog entry in `CHANGELOG.md` under the `Unreleased` section. This will be included in the release notes of the next release. The changelog entry references the PR, so it has to be added after the PR has been opened.
2025

21-
A way to forward debug logs to a file:
22-
```bash
23-
env TF_ACC_LOG_PATH=/tmp/tf.log TF_ACC_LOG=DEBUG TF_LOG=DEBUG make docker-testacc
24-
```
26+
When creating new resources:
27+
* Use the [Plugin Framework](https://developer.hashicorp.com/terraform/plugin/framework/getting-started/code-walkthrough) for new resources.
28+
* Use an existing resource (e.g. `internal/elasticsearch/security/system_user`) as a template.
29+
* Some resources use the deprecated Terraform SDK, so only resources using the new Terraform Framework should be used as reference.
30+
* Use the generated API clients to interact with the Kibana APIs. (See [Working with Generated API Clients](#working-with-generated-api-clients)
31+
* Add a documentation template and examples for the resource. See [Updating Documentation](#updating-documentation) for more details.
32+
* Write unit and acceptance tests.
2533

34+
### Useful Commands
2635

27-
## Update documentation
36+
* `make build`: Build the provider.
37+
* `make lint`: Lints and formats the code.
38+
* `make test`: Run unit tests.
39+
* `make docs-generate`: Generate documentation.
40+
* [Running & Debugging the Provider](#running--debugging-the-provider)
41+
* [Running Acceptance Tests](#running-acceptance-tests)
2842

29-
Update documentation templates in `./templates` directory and re-generate docs via:
30-
```bash
31-
make docs-generate
32-
```
43+
### Running & Debugging the Provider
3344

34-
## Update `./CHANGELOG.md`
45+
You can run the currently checked-out code for local testing and use it with Terraform.
3546

36-
List of previous commits is a good example of what should be included in the changelog.
47+
Also see [Terraform docs on debugging](https://developer.hashicorp.com/terraform/plugin/debugging#starting-a-provider-in-debug-mode).
3748

49+
Run the provider in debug mode and reattach the provider in Terraform:
50+
* Launch `main.go` with the `-debug` flag from your IDE.
51+
* Or launch it with `go run main.go -debug` from the command line.
52+
* After launching, the provider will print an env var. Copy the printed `TF_REATTACH_PROVIDERS='{…}'` value.
53+
* Export it in your shell where you run Terraform: `export TF_REATTACH_PROVIDERS='{…}'`.
54+
* Terraform will now talk to your debug instance, and you can set breakpoints.
3855

39-
## Pull request
56+
### Running Acceptance Tests
4057

41-
Format the code before pushing:
42-
```bash
43-
make fmt
44-
```
58+
Acceptance tests spin up Elasticsearch, Kibana, and Fleet with Docker and run tests in a Go container.
4559

46-
Check if the linting:
4760
```bash
48-
make lint
49-
```
61+
# Start Elasticsearch, Kibana, and Fleet
62+
make docker-fleet
5063

51-
Create a PR and check acceptance test matrix is green.
64+
# Run all tests
65+
make testacc
5266

53-
## Run provider with local terraform
67+
# Run a specific test
68+
make testacc TESTARGS='-run ^TestAccResourceDataStreamLifecycle$$'
5469

55-
TBD
70+
# Cleanup created docker containers
71+
make docker-clean
72+
```
5673

57-
## Releasing
74+
### Working with Generated API Clients
75+
76+
If your work involves the Kibana API, the API client can be generated directly from the Kibana OpenAPI specs:
77+
- For Kibana APIs, use the generated client in `generated/kbapi`.
78+
- To add new endpoints, see [generated/kbapi/README.md](generated/kbapi/README.md).
79+
- Regenerate clients with:
80+
```sh
81+
make transform generate
82+
```
83+
84+
The codebase includes a number of deprecated clients which should not be used anymore:
85+
- `libs/go-kibana-rest`: Fork of an external library, which is not maintained anymore.
86+
- `generated/alerting`, `generated/connectors`, `generated/slo`: Older generated clients, but based on non-standard specs. If any of these APIs are needed, they should be included in the `kbapi` client.
87+
88+
### Updating Documentation
89+
90+
Docs are generated from templates in `templates/` and examples in `examples/`.
91+
* Update or add templates and examples.
92+
* Run `make docs-generate` to produce files under `docs/`.
93+
* Commit the generated files. `make lint` will fail if docs are stale.
94+
95+
## Project Structure
96+
97+
A quick overview over what's in each folder:
98+
99+
* `docs/` - Documentation files
100+
* `data-sources/` - Documentation for Terraform data sources
101+
* `guides/` - User guides and tutorials
102+
* `resources/` - Documentation for Terraform resources
103+
* `examples/` - Example Terraform configurations
104+
* `cloud/` - Examples using the cloud to launch testing stacks
105+
* `data-sources/` - Data source usage examples
106+
* `resources/` - Resource usage examples
107+
* `provider/` - Provider configuration examples
108+
* `generated/` - Auto-generated clients from the `generate-clients` make target
109+
* `kbapi/` - Kibana API client
110+
* `alerting/` - (Deprecated) Kibana alerting API client
111+
* `connectors/` - (Deprecated) Kibana connectors API client
112+
* `slo/` - (Deprecated) SLO (Service Level Objective) API client
113+
* `internal/` - Internal Go packages
114+
* `acctest/` - Acceptance test utilities
115+
* `clients/` - API client implementations
116+
* `elasticsearch/` - Elasticsearch-specific logic
117+
* `fleet/` - Fleet management functionality
118+
* `kibana/` - Kibana-specific logic
119+
* `models/` - Data models and structures
120+
* `schema/` - Connection schema definitions for plugin framework
121+
* `utils/` - Utility functions
122+
* `versionutils/` - Version handling utilities
123+
* `libs/` - External libraries
124+
* `go-kibana-rest/` - (Deprecated) Kibana REST API client library
125+
* `provider/` - Core Terraform provider implementation
126+
* `scripts/` - Utility scripts for development and CI
127+
* `templates/` - Template files for documentation generation
128+
* `data-sources/` - Data source documentation templates
129+
* `resources/` - Resource documentation templates
130+
* `guides/` - Guide documentation templates
131+
* `xpprovider/` - Additional provider functionality needed for Crossplane
132+
133+
## Releasing (maintainers)
58134

59135
Releasing is implemented in CI pipeline.
60136

@@ -65,4 +141,4 @@ To release a new provider version:
65141
- updates CHANGELOG.md with the list of changes being released.
66142
[Example](https://github.com/elastic/terraform-provider-elasticstack/commit/be866ebc918184e843dc1dd2f6e2e1b963da386d).
67143

68-
* Once the PR is merged, the release CI pipeline can be started by pushing a new release tag to the `main` branch.
144+
* Once the PR is merged, the release CI pipeline can be started by pushing a new release tag to the `main` branch. (`git tag v0.11.13 && git push origin v0.11.13`)

README.md

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -76,64 +76,9 @@ provider "elasticstack" {
7676
}
7777
```
7878

79-
8079
## Developing the Provider
8180

82-
If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (see [Requirements](#requirements)).
83-
84-
To compile the provider, run `go install`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.
85-
86-
To install the provider locally into the `~/.terraform.d/plugins/...` directory one can use `make install` command. This will allow to refer this provider directly in the Terraform configuration without needing to download it from the registry.
87-
88-
To generate or update documentation, run `make gen`. All the generated docs will have to be committed to the repository as well.
89-
90-
In order to run the full suite of Acceptance tests, run `make testacc`.
91-
92-
If you have [Docker](https://docs.docker.com/get-docker/) installed, you can use following command to start the Elasticsearch container and run Acceptance tests against it:
93-
94-
```sh
95-
$ make docker-testacc
96-
```
97-
98-
To clean up the used containers and to free up the assigned container names, run `make docker-clean`.
99-
100-
Note: there have been some issues encountered when using `tfenv` for local development. It's recommended you move your version management for terraform to `asdf` instead.
101-
102-
103-
### Requirements
104-
105-
- [Terraform](https://www.terraform.io/downloads.html) >= 1.0.0
106-
- [Go](https://golang.org/doc/install) >= 1.19
107-
108-
109-
### Building The Provider
110-
111-
1. Clone the repository
112-
1. Enter the repository directory
113-
1. Build the provider using the `make install` command:
114-
```sh
115-
$ make install
116-
```
117-
118-
119-
### Adding Dependencies
120-
121-
This provider uses [Go modules](https://github.com/golang/go/wiki/Modules).
122-
Please see the Go documentation for the most up to date information about using Go modules.
123-
124-
To add a new dependency `github.com/author/dependency` to your Terraform provider:
125-
126-
```
127-
go get github.com/author/dependency
128-
go mod tidy
129-
```
130-
131-
Then commit the changes to `go.mod` and `go.sum`.
132-
133-
### Generating Kibana clients
134-
135-
Kibana clients for some APIs are generated based on Kibana OpenAPI specs.
136-
Please see [Makefile](./Makefile) tasks for more details.
81+
See [CONTRIBUTING.md](CONTRIBUTING.md)
13782

13883
## Support
13984

docs/resources/elasticsearch_data_stream_lifecycle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: |-
66
Manages Lifecycle for Elasticsearch Data Streams
77
---
88

9-
# Resource: elasticstack_elasticsearch_data_stream
9+
# Resource: elasticstack_elasticsearch_data_stream_lifecycle
1010

1111
Configures the data stream lifecycle for the targeted data streams, see: https://www.elastic.co/guide/en/elasticsearch/reference/current/data-stream-apis.html
1212

docs/resources/kibana_synthetics_monitor.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,13 @@ resource "elasticstack_kibana_synthetics_monitor" "my_monitor" {
7272
- `http` (Attributes) HTTP Monitor specific fields (see [below for nested schema](#nestedatt--http))
7373
- `icmp` (Attributes) ICMP Monitor specific fields (see [below for nested schema](#nestedatt--icmp))
7474
- `locations` (List of String) Where to deploy the monitor. Monitors can be deployed in multiple locations so that you can detect differences in availability and response times across those locations.
75+
- `namespace` (String) The data stream namespace. Note: if you change its value, kibana creates new datastream. A user needs permissions for new/old datastream in update case to be able to see full monitor history. The `namespace` field should be lowercase and not contain spaces. The namespace must not include any of the following characters: *, \, /, ?, ", <, >, |, whitespace, ,, #, :, or -. Default: `default`
7576
- `params` (String) Monitor parameters. Raw JSON object, use `jsonencode` function to represent JSON
7677
- `private_locations` (List of String) These Private Locations refer to locations hosted and managed by you, whereas locations are hosted by Elastic. You can specify a Private Location using the location’s name.
7778
- `retest_on_failure` (Boolean) Enable or disable retesting when a monitor fails. By default, monitors are automatically retested if the monitor goes from "up" to "down". If the result of the retest is also "down", an error will be created, and if configured, an alert sent. Then the monitor will resume running according to the defined schedule. Using retest_on_failure can reduce noise related to transient problems. Default: `true`.
7879
- `schedule` (Number) The monitor’s schedule in minutes. Supported values are 1, 3, 5, 10, 15, 30, 60, 120 and 240.
7980
- `service_name` (String) The APM service name.
80-
- `space_id` (String) The namespace field should be lowercase and not contain spaces. The namespace must not include any of the following characters: *, \, /, ?, ", <, >, |, whitespace, ,, #, :, or -. Default: `default`
81+
- `space_id` (String) Kibana space. The space ID that is part of the Kibana URL when inside the space. Space IDs are limited to lowercase alphanumeric, underscore, and hyphen characters (a-z, 0-9, _, and -). You are cannot change the ID with the update operation.
8182
- `tags` (List of String) An array of tags.
8283
- `tcp` (Attributes) TCP Monitor specific fields (see [below for nested schema](#nestedatt--tcp))
8384
- `timeout` (Number) The monitor timeout in seconds, monitor will fail if it doesn’t complete within this time. Default: `16`

generated/connectors/README.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)