Skip to content

Commit 54d9b17

Browse files
authored
[Doc] Update CONTRIBUTING guide for plugin framework resources (#4078)
## Changes <!-- Summary of your changes that are easy to understand --> Update the guide to give detailed information on how to navigate and get started with adding / migrating resources to plugin framework. ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> NA - [ ] `make test` run locally - [ ] relevant change in `docs/` folder - [ ] covered with integration tests in `internal/acceptance` - [ ] relevant acceptance tests are passing - [ ] using Go SDK
1 parent c56bc90 commit 54d9b17

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

CONTRIBUTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,22 @@ We are migrating the resource from SDKv2 to Plugin Framework provider and hence
118118
- `pluginfw`: Contains the changes specific to Plugin Framework. This package shouldn't depend on sdkv2 or common.
119119
- `sdkv2`: Contains the changes specific to SDKv2. This package shouldn't depend on pluginfw or common.
120120

121+
### Adding a new resource
122+
1. Check if the directory for this particular resource exists under `internal/providers/pluginfw/resources`, if not create the directory eg: `cluster`, `volume` etc... Please note: Resources and Data sources are organized under the same package for that service.
123+
2. Create a file with resource_resource-name.go and write the CRUD methods, schema for that resource. For reference, please take a look at existing resources eg: `resource_quality_monitor.go`
124+
3. Create a file with `resource_resource-name_acc_test.go` and add integration tests here.
125+
4. Create a file with `resource_resource-name_test.go` and add unit tests here. Note: Please make sure to abstract specific method of the resource so they are unit test friendly and not testing internal part of terraform plugin framework library. You can compare the diagnostics, for example: please take a look at: `data_cluster_test.go`
126+
5. Add the resource under `internal/providers/pluginfw/pluginfw.go` in `Resources()` method. Please update the list so that it stays in alphabetically sorted order.
127+
6. Create a PR and send it for review.
128+
129+
### Adding a new data source
130+
1. Check if the directory for this particular datasource exists under `internal/providers/pluginfw/resources`, if not create the directory eg: `cluster`, `volume` etc... Please note: Resources and Data sources are organized under the same package for that service.
131+
2. Create a file with `data_resource-name.go` and write the CRUD methods, schema for that data source. For reference, please take a look at existing data sources eg: `data_cluster.go`
132+
3. Create a file with `data_resource-name_acc_test.go` and add integration tests here.
133+
4. Create a file with `data_resource-name_test.go` and add unit tests here. Note: Please make sure to abstract specific method of the resource so they are unit test friendly and not testing internal part of terraform plugin framework library. You can compare the diagnostics, for example: please take a look at: `data_cluster_test.go`
134+
5. Add the resource under `internal/providers/pluginfw/pluginfw.go` in `DataSources()` method. Please update the list so that it stays in alphabetically sorted order.
135+
6. Create a PR and send it for review.
136+
121137
### Migrating resource to plugin framework
122138
Ideally there shouldn't be any behaviour change when migrating a resource or data source to either Go SDk or Plugin Framework.
123139
- Please make sure there are no breaking differences due to changes in schema by running: `make diff-schema`.

0 commit comments

Comments
 (0)