How to view the remote state terraform version

Viewed 291

A project uses a remote S3 terraform state. I want to add a .terraform-version file so that tfenv can automatically switch to it. But first I want to verify the version currently stored in the remote state. I thought that this was one way to do it:

terraform state pull | grep terraform_version

But as pointed out, it does not provide the remote version, only the local. Is there a command to retrieve the remote terraform version?

1 Answers

You should not use state pull to get the remote version. It will give you your local version as the command converts the state to your local version before output.

You can check https://www.terraform.io/docs/cli/commands/state/pull.html

Note: This command cannot be used to inspect the Terraform version of the remote state, as it will always be converted to the current Terraform version before output.

Related