-
Notifications
You must be signed in to change notification settings - Fork 11
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
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…esSameAny, ValuesDiffer, ValuesDifferAny, and ValuesDifferAll
…airs state checks
austinvalle
reviewed
May 7, 2024
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
SBGoods
approved these changes
Jul 22, 2024
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!
This was referenced Aug 1, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
.