Backport from 1.5.x: Ignore unknown check results on decode (#374)

This commit is contained in:
Elbaz 2023-09-10 14:58:09 +03:00 committed by GitHub
parent 065ca8fb3b
commit e8c1c3a700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -3,6 +3,7 @@
UPGRADE NOTES: UPGRADE NOTES:
* The `cloud` and `remote` backends will no longer default to `app.terraform.io` hostname and will require the hostname to be explicitly specified ([#291](https://github.com/opentffoundation/opentf/pull/291)); * The `cloud` and `remote` backends will no longer default to `app.terraform.io` hostname and will require the hostname to be explicitly specified ([#291](https://github.com/opentffoundation/opentf/pull/291));
* The `login` and `logout` commands will no longer default to `app.terraform.io` hostname and will require the hostname to be explicitly provided as a command-line argument ([#291](https://github.com/opentffoundation/opentf/pull/291)); * The `login` and `logout` commands will no longer default to `app.terraform.io` hostname and will require the hostname to be explicitly provided as a command-line argument ([#291](https://github.com/opentffoundation/opentf/pull/291));
* prevent future possible incompatibility with states that include unknown `check` block result kinds. ([#355](https://github.com/opentffoundation/opentf/pull/355));
NEW FEATURES: NEW FEATURES:
* `opentf test`: The previously experimental `opentf test` command has been moved out of experimental. This comes with a significant change in how OpenTF tests are written and executed. * `opentf test`: The previously experimental `opentf test` command has been moved out of experimental. This comes with a significant change in how OpenTF tests are written and executed.

View File

@ -525,7 +525,11 @@ func decodeCheckResultsV4(in []checkResultsV4) (*states.CheckResults, tfdiags.Di
for _, aggrIn := range in { for _, aggrIn := range in {
objectKind := decodeCheckableObjectKindV4(aggrIn.ObjectKind) objectKind := decodeCheckableObjectKindV4(aggrIn.ObjectKind)
if objectKind == addrs.CheckableKindInvalid { if objectKind == addrs.CheckableKindInvalid {
diags = diags.Append(fmt.Errorf("unsupported checkable object kind %q", aggrIn.ObjectKind)) // We cannot decode a future unknown check result kind, but
// for forwards compatibility we need not treat this as an
// error. Eliding unknown check results will not result in
// significant data loss and allows us to maintain state file
// interoperability in the 1.x series.
continue continue
} }