Merge pull request #27197 from hashicorp/alisdair/terraform-remote-state-version-fix

Fix terraform_remote_state backend version check
This commit is contained in:
Alisdair McDiarmid 2020-12-08 15:40:28 -05:00 committed by GitHub
commit 94e2fe9a38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import (
"log" "log"
"github.com/hashicorp/terraform/backend" "github.com/hashicorp/terraform/backend"
"github.com/hashicorp/terraform/backend/remote"
"github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers" "github.com/hashicorp/terraform/providers"
"github.com/hashicorp/terraform/tfdiags" "github.com/hashicorp/terraform/tfdiags"
@ -233,6 +234,12 @@ func getBackend(cfg cty.Value) (backend.Backend, cty.Value, tfdiags.Diagnostics)
return nil, cty.NilVal, diags return nil, cty.NilVal, diags
} }
// If this is the enhanced remote backend, we want to disable the version
// check, because this is a read-only operation
if rb, ok := b.(*remote.Remote); ok {
rb.IgnoreVersionConflict()
}
return b, newVal, diags return b, newVal, diags
} }