hashicorp / hashicorp/terraform-plugin-testing
Import Testing Additions In Documentation
- Dominant language
- Go
- Stars
- 68
- Forks
- 22
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 1
Description
### Does this documentation exist?
* [ ] This is new documentation
* [x] This is an enhancement to existing documentation
### Where would you expect to find this documentation?
* [x] On terraform.io
* [ ] In the GoDoc for this module
* [x] In this repo as a markdown file
* [ ] Somewhere else
#### Details
I would expect this to be an addition to the [TestStep Documentation](https://developer.hashicorp.com/terraform/plugin/testing/acceptance-tests/teststep)
This is intended to provide more clear and specific guidance on using the Import test functionality of a TestStep.
### Description
While there is references to this in the SDKv2 Docs: https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/import#recommendations-for-import
This is not found in the corresponding Framework docs: https://developer.hashicorp.com/terraform/plugin/framework/resources/import
Additionally, the TestStep docs do not discuss it in much detail.
From a "New User" perspective, writing a Import test is ambiguous, since the "conventional wisdom" would suggest creating a resource outside of the Terraform execution, then using Terraform to import that, since that's the main use case for an import. However, the "Import" test step functionality is intended for the user to "Create" the resource using the previous TestSteps, then the import happens in a special process / state directory to verify that function.
I think specifically calling out this process and the associated details around Import testing in the TestCase docs is a necessary addition to ensure developers understand clearly how to implement Import testing for their resources.
### References
Contributor guide
Assessment
This issue has not been assessed yet.