terraform plan 说我正在使用不同版本。

huangapple go评论61阅读模式
英文:

terraform plan says I'm using a different version

问题

terraform plan 声称我正在使用与 terraform version 中指示的版本不同的版本。

当我运行 terraform version 时,它显示我有 1.5.2

Terraform v1.5.2
on windows_amd64

但是当我运行 terraform apply 时,它显示我有 1.1.6

│ Error: Unsupported Terraform Core version
│   on versions.tf line 9, in terraform:
│    9:   required_version = ">= 1.2"
│ This configuration does not support Terraform version 1.1.6. To proceed,
│ either choose another supported Terraform version or update this version
│ constraint. Version constraints are normally set for good reason, so
│ updating the constraint may lead to other errors or unexpected behavior.
英文:

terraform plan claims that I am using a different version than the one indicated in terraform version

When I run terraform version it says I have 1.5.2

Terraform v1.5.2
on windows_amd64

But when I run terraform apply it says I have 1.1.6

│ Error: Unsupported Terraform Core version
│
│   on versions.tf line 9, in terraform:
│    9:   required_version = ">= 1.2"
│
│ This configuration does not support Terraform version 1.1.6. To proceed,
│ either choose another supported Terraform version or update this version
│ constraint. Version constraints are normally set for good reason, so
│ updating the constraint may lead to other errors or unexpected behavior.

答案1

得分: 1

我认为我们今天早些时候可能已经在GitHub问题中讨论过这种情况!我将总结我们在那里学到的内容,以防将来有人在遇到类似问题后在这里找到这个问题。

在看到terraform plan命令的完整输出后,我们发现它包括以下内容:

在远程后端中运行计划。 输出将在此处流式传输。 按Ctrl-C将停止流式传输日志,但不会停止远程计划的运行。

准备远程计划...

等待计划开始...

Terraform v1.1.6
在linux_amd64上

这意味着本地的Terraform CLI要求Terraform Cloud在远程创建计划,而不是在本地计算机上创建计划。它通过运行远程工作区设置中配置的Terraform版本来实现,看起来是v1.1.6。

在使用Terraform Cloud远程操作时,工作区设置中的Terraform版本决定了计划和应用的使用方式,而不管您本地使用的Terraform版本如何。

英文:

I think we may have been discussing this same situation in a GitHub issue earlier today! I'm going to summarize what we learned there in case someone else finds this question here in future after having a similar problem.

After seeing the fuller output of the terraform plan command we saw that it included the following:

Running plan in the remote backend. Output will stream here. Pressing Ctrl-C
will stop streaming the logs, but will not stop the plan running remotely.

Preparing the remote plan...

Waiting for the plan to start...

Terraform v1.1.6
on linux_amd64

This means that the local Terraform CLI asked Terraform Cloud to create a plan remotely rather than creating the plan on the local computer. It did that by running the version of Terraform configured in the remote workspace settings, which appears to be v1.1.6.

When using Terraform Cloud remote operations it's the Terraform version in the workspace settings that decides what is used for planning and applying, regardless of what version of Terraform you are using locally.

答案2

得分: 0

似乎需要重新初始化

首先尝试使用terraform init,然后查看是否有任何变化。

英文:

Seems like it could need to be re-initialised

try using terraform init first then see if that changes anything.

huangapple
  • 本文由 发表于 2023年6月29日 22:32:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/76582063.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定