hashicorp / hashicorp/terraform-plugin-testing

🧹 Enhance Terraform Sweeper documentation

Open
#378 1 comment 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Go
Stars
68
Forks
22
Avg merge
2d 12h
Merged PRs (30d)
1

Description

### Does this documentation exist?

* [x] #386
* [x] This is an enhancement to existing documentation

### Where would you expect to find this documentation?

* [ ] On terraform.io
* [ ] In the GoDoc for this module
* [x] In this repo as a markdown file
* [x] https://developer.hashicorp.com/terraform/plugin/testing/acceptance-tests/sweepers
* [x] https://github.com/hashicorp/terraform-plugin-testing/blob/main/website/docs/plugin/testing/acceptance-tests/sweepers.mdx
* [x] Somewhere else - in the Hashicups example
* [x] https://github.com/hashicorp/terraform-provider-hashicups/blob/main/10-acceptance-tests/GNUmakefile
* [x] https://github.com/search?q=repo%3Ahashicorp%2Fterraform-provider-hashicups%20sweep&type=code

### Description

I would like to follow an idiomatic example of Sweepers, so I can implement them for a provider that is based on the `terraform-plugin-framework` package.

I'm fairly new to Go and creating Terraform providers; [I have tried to follow the Terraform docs, but my sweepers do not run](https://github.com/oscarhermoso/terraform-provider-binarylane/commit/341a9efe685846b9ee98d32ba7a094fb5e4f1200). (No need for you to debug my code, just trying to give some context.)

* The documentation refers to a Makefile, but there is no explanation for what should be in that Makefile
* Ideally document how to sweep without a Makefile also
* Sweeper seems to rely on some environment variables, (I'm assuming `SWEEP` / `SWEEP_ARGS` / `SWEEP_DIR` based on unofficial GitHub code?) but these are not documented
* Not clear what the intended use is of the `region` argument for `SweeperFunc`
* The documentation refers to `TestMain` - I'm not sure if the name is important, or it could be replaced with `TestWhatever`
* Ideally, also include Sweepers in the Hashicups example, because there is very little code for Terraform Framework that can be used as a reference for Sweepers:
* Compare 20k+ result count for mostly SDK v2: https://github.com/search?q=resource.AddTestSweepers&type=code
* and ~600 results for TF Framework - https://github.com/search?q=resource.AddTestSweepers+NOT+sdk&type=code

### References

N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.