Skip to content

Commit

Permalink
Fix terraform_remote_state backend version check
Browse files Browse the repository at this point in the history
The change recently introduced to ensure that remote backend users do
not accidentally upgrade their state file needs to be disabled for all
read-only uses, including the builtin terraform_remote_state data
source.
  • Loading branch information
alisdair committed Dec 8, 2020
1 parent 773884c commit 77035e5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions builtin/providers/terraform/data_source_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"

"github.com/hashicorp/terraform/backend"
"github.com/hashicorp/terraform/backend/remote"
"github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/providers"
"github.com/hashicorp/terraform/tfdiags"
Expand Down Expand Up @@ -215,5 +216,11 @@ func getBackend(cfg cty.Value) (backend.Backend, tfdiags.Diagnostics) {
return nil, 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, diags
}

0 comments on commit 77035e5

Please sign in to comment.