hashicorp / hashicorp/terraform-plugin-testing
Deprecation of Built-In TestCheckFunc Implementations for Checking Pairs of Values
- Dominant language
- Go
- Stars
- 68
- Forks
- 22
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 1
Description
### Background
As part of the implementation of state checks which leverage [tfjson.State](https://pkg.go.dev/github.com/hashicorp/terraform-json#State), built-in state checks, which are implementations of [TestCheckFunc](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-testing/helper/resource#TestCheckFunc) (e.g., [TestCheckResourceAttr](https://pkg.go.dev/github.com/hashicorp/terraform/helper/resource#TestCheckResourceAttr)) are being deprecated in favour of state checks that are based on interrogating [tfjson.State](https://pkg.go.dev/github.com/hashicorp/terraform-json#State).
All of the implementations of [TestCheckFunc](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-testing/helper/resource#TestCheckFunc) which handle checking individual values, will have an equivalent state check implemented with the new state checks that leverage [tfjson.State](https://pkg.go.dev/github.com/hashicorp/terraform-json#State). However, the built-in implementations of [TestCheckFunc](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-testing/helper/resource#TestCheckFunc) which deal with pairs of values will be deprecated without replacement.
| TestCheckFunc | State Check |
| ------------- | ------------- |
| [TestCheckResourceAttrPair](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-testing@v1.6.0/helper/resource#TestCheckResourceAttrPair) | **Deprecated without replacement** |
| [TestCheckTypeSetElemAttrPair](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-testing@v1.6.0/helper/resource#TestCheckTypeSetElemAttrPair) | **Deprecated without replacement** |
### Purpose of this Issue
The purpose of this issue is to provide a placeholder for signalling use-cases and interest in having built-in state checks which operate on [tfjson.State](https://pkg.go.dev/github.com/hashicorp/terraform-json#State) that replicate the behaviour of `TestCheckResourceAttrPair` and/or `TestCheckTypeSetElemAttrPair`.
### References
- #266
- #276
Contributor guide
Assessment
This issue has not been assessed yet.