Skip to content

Commit b57a8dc

Browse files
committed
Merge remote-tracking branch 'upstream/main' into mw-resource-2.0
2 parents 07068c7 + 85cf3f4 commit b57a8dc

Some content is hidden

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

53 files changed

+6610
-12846
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.24.5@sha256:ef5b4be1f94b36c90385abd9b6b4f201723ae28e71acacb76d00687333c17282"
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: 4 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -21,65 +21,9 @@ jobs:
2121
permissions:
2222
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete.
2323
contents: read
24-
env:
25-
ELASTICSEARCH_ENDPOINTS: "http://localhost:9200"
26-
ELASTICSEARCH_USERNAME: "elastic"
27-
ELASTICSEARCH_PASSWORD: password
28-
KIBANA_ENDPOINT: "http://localhost:5601"
29-
KIBANA_USERNAME: "elastic"
30-
KIBANA_PASSWORD: password
31-
KIBANA_SYSTEM_USERNAME: kibana_system
32-
KIBANA_SYSTEM_PASSWORD: password
33-
TF_ACC: "1"
34-
services:
35-
elasticsearch:
36-
image: docker.elastic.co/elasticsearch/elasticsearch:9.0.3@sha256:b21843a4a2efafcb0475ead137ce0a669fca412739694de833a2697f121a87b9
37-
env:
38-
discovery.type: single-node
39-
xpack.security.enabled: true
40-
xpack.security.authc.api_key.enabled: true
41-
xpack.security.authc.token.enabled: true
42-
xpack.watcher.enabled: true
43-
xpack.license.self_generated.type: trial
44-
repositories.url.allowed_urls: https://example.com/*
45-
path.repo: /tmp
46-
ELASTIC_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
47-
ports:
48-
- 9200:9200
49-
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
50-
kibana:
51-
image: docker.elastic.co/kibana/kibana:9.0.3@sha256:c4c00a485fbc3619d8373f3bc74e9dd5b5a34380ef50442be4366e8fb57cd50a
52-
env:
53-
SERVER_NAME: kibana
54-
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
55-
ELASTICSEARCH_USERNAME: ${{ env.KIBANA_SYSTEM_USERNAME }}
56-
ELASTICSEARCH_PASSWORD: ${{ env.KIBANA_SYSTEM_PASSWORD }}
57-
XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: a7a6311933d3503b89bc2dbc36572c33a6c10925682e591bffcab6911c06786d
58-
# LOGGING_ROOT_LEVEL: debug
59-
ports:
60-
- 5601:5601
61-
options: --health-cmd="curl http://localhost:5601/api/status" --health-interval=10s --health-timeout=5s --health-retries=10
62-
fleet:
63-
image: docker.elastic.co/elastic-agent/elastic-agent:9.0.3@sha256:c143c196d75078d1633c436fc8ab1e8c0d387d7131e3ace8bac1c1eea6d583ff
64-
env:
65-
SERVER_NAME: fleet
66-
FLEET_ENROLL: "1"
67-
FLEET_URL: https://fleet:8220
68-
FLEET_INSECURE: "true"
69-
FLEET_SERVER_ENABLE: "1"
70-
FLEET_SERVER_POLICY_ID: fleet-server
71-
FLEET_SERVER_ELASTICSEARCH_HOST: http://elasticsearch:9200
72-
FLEET_SERVER_ELASTICSEARCH_INSECURE: "true"
73-
FLEET_SERVER_INSECURE_HTTP: "true"
74-
KIBANA_HOST: http://kibana:5601
75-
KIBANA_FLEET_SETUP: "1"
76-
KIBANA_FLEET_PASSWORD: ${{ env.ELASTICSEARCH_PASSWORD }}
77-
ports:
78-
- 8220:8220
79-
options: --restart="unless-stopped"
8024

8125
steps:
82-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
26+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
8327
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
8428
with:
8529
go-version-file: 'go.mod'
@@ -88,6 +32,9 @@ jobs:
8832
with:
8933
terraform_wrapper: false
9034

35+
- name: Setup Elastic Stack
36+
run: make docker-fleet
37+
9138
- name: Get dependencies
9239
run: make setup
9340

.github/workflows/test.yml

Lines changed: 4 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@11bd71901bbe5b1630ceea73d27597364c9af683 # 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
37+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
3838
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
3939
with:
4040
go-version-file: 'go.mod'
@@ -126,9 +126,10 @@ jobs:
126126
- '8.15.5'
127127
- '8.16.2'
128128
- '8.17.0'
129+
- '8.18.3'
129130
- '9.0.3'
130131
steps:
131-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
132+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
132133
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5
133134
with:
134135
go-version-file: 'go.mod'

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
## [Unreleased]
22

33
- Create `elasticstack_kibana_maintenance_window` resource. ([#1224](https://github.com/elastic/terraform-provider-elasticstack/pull/1224))
4+
- Add support for `solution` field in `elasticstack_kibana_space` resource and data source ([#1102](https://github.com/elastic/terraform-provider-elasticstack/issues/1102))
45
- Add `slo_id` validation to `elasticstack_kibana_slo` ([#1221](https://github.com/elastic/terraform-provider-elasticstack/pull/1221))
56
- Add `ignore_missing_component_templates` to `elasticstack_elasticsearch_index_template` ([#1206](https://github.com/elastic/terraform-provider-elasticstack/pull/1206))
67
- Prevent provider panic when a script exists in state, but not in Elasticsearch ([#1218](https://github.com/elastic/terraform-provider-elasticstack/pull/1218))
8+
- 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.
9+
- 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))
710

811
## [0.11.17] - 2025-07-21
912

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`)

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ install: build ## Install built provider into the local terraform cache
246246

247247
.PHONY: tools
248248
tools: $(GOBIN) ## Download golangci-lint locally if necessary.
249-
@[[ -f $(GOBIN)/golangci-lint ]] || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v2.2.2
249+
@[[ -f $(GOBIN)/golangci-lint ]] || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v2.4.0
250250

251251
.PHONY: golangci-lint
252252
golangci-lint:

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/data-sources/kibana_spaces.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ Required:
4141
Optional:
4242

4343
- `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).
4544
- `image_url` (String) The data-URL encoded image to display in the space avatar.
4645

4746
Read-Only:
4847

4948
- `color` (String) The hexadecimal color code used in the space avatar. By default, the color is automatically generated from the space name.
49+
- `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).
5050
- `id` (String) Internal identifier of the resource.
5151
- `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.
52+
- `solution` (String) The solution view for the space. Valid options are `security`, `oblt`, `es`, or `classic`.

0 commit comments

Comments
 (0)