Skip to content

Commit eaa2516

Browse files
committed
Review feedback
1 parent ea92323 commit eaa2516

File tree

1 file changed

+21
-36
lines changed

1 file changed

+21
-36
lines changed

CONTRIBUTING.md

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,52 +21,48 @@ Requirements:
2121
* Run unit and acceptance tests (See [Running Acceptance Tests](#running-acceptance-tests)).
2222
* Run `make fmt`, `make lint`.
2323
* 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.
2524
* Submit your PR for review.
25+
* 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.
2626

2727
When creating new resources:
2828
* Use the [Plugin Framework](https://developer.hashicorp.com/terraform/plugin/framework/getting-started/code-walkthrough) for new resources.
2929
* Use an existing resource (e.g. `internal/elasticsearch/security/system_user`) as a template.
3030
* Some resources use the deprecated Terraform SDK, so only resources using the new Terraform Framework should be used as reference.
3131
* 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`.
32+
* Add a documentation template and examples for the resource. See [Updating Documentation](#updating-documentation) for more details.
3333
* Write unit and acceptance tests.
3434

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-
4435
### Useful Commands
4536

4637
* `make build`: Build the provider.
47-
* `make install`: Install the provider.
48-
* `make fmt`: Format the code.
49-
* `make lint`: Lint the code.
38+
* `make lint`: Lints and formats the code.
5039
* `make test`: Run unit tests.
5140
* `make docs-generate`: Generate documentation.
5241

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

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

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

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

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
61+
# Run a specific test
62+
make testacc TESTARGS='-run ^TestAccResourceDataStreamLifecycle$$'
63+
64+
# Cleanup created docker containers
65+
make docker-clean
7066
```
7167

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

8278
The codebase includes a number of deprecated clients which should not be used anymore:
8379
- `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.
80+
- `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.
8881

8982
### Updating Documentation
9083

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

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-
10489
## Project Structure
10590

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

0 commit comments

Comments
 (0)