Skip to content

Commit 2e25dec

Browse files
committed
Review feedback
1 parent ea92323 commit 2e25dec

File tree

1 file changed

+24
-40
lines changed

1 file changed

+24
-40
lines changed

CONTRIBUTING.md

Lines changed: 24 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This guide explains how to set up your environment, make changes, and submit a P
55
## Development Setup
66

77
* Fork and clone the repo.
8-
* Setup your preferred IDE (Intelliji, VSCode, etc.)
8+
* Setup your preferred IDE (IntelliJ, VSCode, etc.)
99

1010
Requirements:
1111
* [Terraform](https://www.terraform.io/downloads.html) >= 1.0.0
@@ -15,58 +15,53 @@ Requirements:
1515
## Development Workflow
1616

1717
* Create a new branch for your changes.
18-
* Make your changes. See [Useful Commands](#useful-commands) and [Debugging](#debugging).
19-
* GitHub Copilot can be used to help with these changes (See [Using Copilot](#using-copilot))
18+
* Make your changes. See [Useful Commands](#useful-commands) and [Debugging](#running--debugging-the-provider).
2019
* Validate your changes
2120
* Run unit and acceptance tests (See [Running Acceptance Tests](#running-acceptance-tests)).
22-
* Run `make fmt`, `make lint`.
21+
* Run `make lint` to check linting and formatting. For this check to succeed, all changes must have been committed.
2322
* All checks also run automatically on every PR.
24-
* Add a changelog entry in `CHANGELOG.md` under the `Unreleased` section. This will be included in the release notes of the next release.
2523
* 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.
2625

2726
When creating new resources:
2827
* Use the [Plugin Framework](https://developer.hashicorp.com/terraform/plugin/framework/getting-started/code-walkthrough) for new resources.
2928
* Use an existing resource (e.g. `internal/elasticsearch/security/system_user`) as a template.
3029
* Some resources use the deprecated Terraform SDK, so only resources using the new Terraform Framework should be used as reference.
3130
* Use the generated API clients to interact with the Kibana APIs. (See [Working with Generated API Clients](#working-with-generated-api-clients)
32-
* Add documentation and examples for the resource. Update the generated docs with `make docs-generate`.
31+
* Add a documentation template and examples for the resource. See [Updating Documentation](#updating-documentation) for more details.
3332
* Write unit and acceptance tests.
3433

35-
36-
## Using Copilot
37-
38-
GitHub Copilot can speed up development, but you’re responsible for correctness:
39-
* Create an issue describing the desired change and acceptance criteria.
40-
* Assign the issue to Copilot and iterate with prompts.
41-
* Review outputs carefully; add tests and adjust as needed.
42-
* Example issue: https://github.com/elastic/terraform-provider-elasticstack/issues/1219
43-
4434
### Useful Commands
4535

4636
* `make build`: Build the provider.
47-
* `make install`: Install the provider.
48-
* `make fmt`: Format the code.
49-
* `make lint`: Lint the code.
37+
* `make lint`: Lints and formats the code.
5038
* `make test`: Run unit tests.
5139
* `make docs-generate`: Generate documentation.
5240

41+
### Running & Debugging the Provider
42+
43+
Run the provider in debug mode and reattach the provider in Terraform:
44+
* Launch `main.go` with the `-debug` flag from your IDE.
45+
* After launching, the provider will print an env var. Copy the printed `TF_REATTACH_PROVIDERS='{…}'` value.
46+
* Export it in your shell where you run Terraform: `export TF_REATTACH_PROVIDERS='{…}'`.
47+
* Terraform will now talk to your debug instance, and you can set breakpoints.
48+
5349
#### Running Acceptance Tests
5450

5551
Acceptance tests spin up Elasticsearch, Kibana, and Fleet with Docker and run tests in a Go container.
5652

57-
Quick start (default stack version from Makefile):
5853
```bash
59-
make docker-testacc
60-
```
54+
# Start Elasticsearch, Kibana, and Fleet
55+
make docker-fleet
6156

62-
Run a single test with terraform debug enabled:
63-
```bash
64-
env TF_LOG=DEBUG make docker-testacc TESTARGS='-run ^TestAccResourceDataStreamLifecycle$$'
65-
```
57+
# Run all tests
58+
make testacc
6659

67-
A way to forward debug logs to a file:
68-
```bash
69-
env TF_ACC_LOG_PATH=/tmp/tf.log TF_ACC_LOG=DEBUG TF_LOG=DEBUG make docker-testacc
60+
# Run a specific test
61+
make testacc TESTARGS='-run ^TestAccResourceDataStreamLifecycle$$'
62+
63+
# Cleanup created docker containers
64+
make docker-clean
7065
```
7166

7267
### Working with Generated API Clients
@@ -81,10 +76,7 @@ If your work involves the Kibana API, the API client can be generated directly f
8176

8277
The codebase includes a number of deprecated clients which should not be used anymore:
8378
- `libs/go-kibana-rest`: Fork of an external library, which is not maintained anymore.
84-
- `generated/alerting`
85-
- `generated/connectors`
86-
- `generated/slo`
87-
- `internal/clients/*`: Manually written clients. These should only be used/extended if it is not possible to use the generated clients.
79+
- `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.
8880

8981
### Updating Documentation
9082

@@ -93,14 +85,6 @@ Docs are generated from templates in `templates/` and examples in `examples/`.
9385
* Run `make docs-generate` to produce files under `docs/`.
9486
* Commit the generated files. `make lint` will fail if docs are stale.
9587

96-
### Debugging
97-
98-
Run the provider in debug mode and reattach the provider in Terraform:
99-
* Launch `main.go` with the `-debug` flag from your IDE.
100-
* After launching, the provider will print an env var. Copy the printed `TF_REATTACH_PROVIDERS='{…}'` value.
101-
* Export it in your shell where you run Terraform: `export TF_REATTACH_PROVIDERS='{…}'`.
102-
* Terraform will now talk to your debug instance, and you can set breakpoints.
103-
10488
## Project Structure
10589

10690
A quick overview over what's in each folder:

0 commit comments

Comments
 (0)