-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement comparison state checks to replace TestCheckResourceAttrPtr
, TestCheckResourceAttrPair
and TestCheckTypeSetElemAttrPair
#330
Conversation
…esSameAny, ValuesDiffer, ValuesDifferAny, and ValuesDifferAll
…airs state checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM, will be interested to see the documentation as I can imagine we'll need to be prescriptive on "when" provider developers should use one of these state checks 👍🏻
Bumps [hashicorp/setup-terraform](https://github.com/hashicorp/setup-terraform) from 3.1.0 to 3.1.1. - [Release notes](https://github.com/hashicorp/setup-terraform/releases) - [Changelog](https://github.com/hashicorp/setup-terraform/blob/main/CHANGELOG.md) - [Commits](hashicorp/setup-terraform@97f030c...651471c) --- updated-dependencies: - dependency-name: hashicorp/setup-terraform dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [hashicorp/setup-copywrite](https://github.com/hashicorp/setup-copywrite) from 1.1.2 to 1.1.3. - [Release notes](https://github.com/hashicorp/setup-copywrite/releases) - [Commits](hashicorp/setup-copywrite@867a1a2...32638da) --- updated-dependencies: - dependency-name: hashicorp/setup-copywrite dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: hashicorp-tsccr[bot] <hashicorp-tsccr[bot]@users.noreply.github.com>
Bumps [github.com/hashicorp/terraform-json](https://github.com/hashicorp/terraform-json) from 0.21.0 to 0.22.0. - [Release notes](https://github.com/hashicorp/terraform-json/releases) - [Commits](hashicorp/terraform-json@v0.21.0...v0.22.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-json dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/hashicorp/terraform-json](https://github.com/hashicorp/terraform-json) from 0.22.0 to 0.22.1. - [Release notes](https://github.com/hashicorp/terraform-json/releases) - [Commits](hashicorp/terraform-json@v0.22.0...v0.22.1) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/hashicorp/terraform-exec](https://github.com/hashicorp/terraform-exec) from 0.20.0 to 0.21.0. - [Release notes](https://github.com/hashicorp/terraform-exec/releases) - [Changelog](https://github.com/hashicorp/terraform-exec/blob/main/CHANGELOG.md) - [Commits](hashicorp/terraform-exec@v0.20.0...v0.21.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-exec dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
… and CLI options) (#331) * sloppy first commit! * add version checks and tests * add changelogs * update terraform-plugin-go * spelling fix * update `terraform-json` * switch to pointer bool value
* Add `float32exact` and `int32exact` types * Update website documentation * Add changelog entries * Update changelog wording
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.24.0 to 0.25.0. - [Commits](golang/crypto@v0.24.0...v0.25.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
… and CLI options) (#331) * sloppy first commit! * add version checks and tests * add changelogs * update terraform-plugin-go * spelling fix * update `terraform-json` * switch to pointer bool value
* Add `float32exact` and `int32exact` types * Update website documentation * Add changelog entries * Update changelog wording
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Closes: #295
References: #282
References: #187
Background
During the implementation of Consider Adding State Check Equivalents to Plan Checks, it was intended that the pre-built
TestCheckFunc
implementations would be deprecated. However, these deprecations were not included at that time partly because there was no satisfactory re-implementation ofTestCheckResourceAttrPtr
, which used the new style state checks which leverage tfjson.State, and neitherTestCheckResourceAttrPair
, norTestCheckTypeSetElemAttrPair
were re-implemented as it was unclear whether there was a need for such checks.Comparison State Checks and the
ValueComparer
interfaceThe concepts from Consider Multiple Value Checking Interface have been used to implement comparison state checks to replace the built-in
TestCheckFunc
checks forTestCheckResourceAttrPtr
,TestCheckResourceAttrPair
, andTestCheckTypeSetElemAttrPair
. All three implementations make use of theValueComparer
interface.Replacement for
TestCheckResourceAttrPtr
-CompareValue
Replacement for
TestCheckResourceAttrPair
-CompareValuePairs
Replacement for
TestCheckTypeSetElemAttrPair
-CompareValueCollection
Implementations of the
ValueComparer
interfaceThere are implementations of the
ValueComparer
interface for:ValuesSame
ValuesDiffer
These various implementations can be used in conjunction with
CompareValue
,CompareValueCollection
, andCompareValuePairs
.