使用 1.1 版初始化 Terraform 时出错
Getting Error while initializing Terraform with version 1.1
我正在尝试按照此 link :
将我的本地状态文件迁移到 TF Cloud
https://learn.hashicorp.com/tutorials/terraform/cloud-migrate?in=terraform/cloud
我已经有了我的工作区,并且我已经使用我得到的 API 令牌从 CMD 行登录到 TF Cloud。我的代码如下所示
terraform {
required_version = ">= 1.1.0"
required_providers {
random = {
source = "hashicorp/random"
version = "3.0.1"
}
}
cloud {
organization = "Pallab-Training"
workspaces {
name = "terraform-azurerm-networking"
}
}
}
/* terraform {
required_providers {
random = {
source = "hashicorp/random"
version = "3.0.1"
}
}
required_version = "~> 1.0"
} */
variable "name_length" {
description = "The number of words in the pet name"
default = "3"
}
resource "random_pet" "pet_name" {
length = var.name_length
separator = "-"
}
output "pet_name" {
value = random_pet.pet_name.id
}
但是我不断收到附件中的错误。我正在尝试使用 Terraform 1.1
知道为什么会出现此错误,即使我按原样遵循教程
cloud
在 v1.0 中不受支持。来自 docs:
Because the cloud block is not supported by older versions of Terraform, you must use 1.1.0 or higher in order to follow this tutorial.
您必须升级您的 TF。
我正在尝试按照此 link :
将我的本地状态文件迁移到 TF Cloudhttps://learn.hashicorp.com/tutorials/terraform/cloud-migrate?in=terraform/cloud
我已经有了我的工作区,并且我已经使用我得到的 API 令牌从 CMD 行登录到 TF Cloud。我的代码如下所示
terraform {
required_version = ">= 1.1.0"
required_providers {
random = {
source = "hashicorp/random"
version = "3.0.1"
}
}
cloud {
organization = "Pallab-Training"
workspaces {
name = "terraform-azurerm-networking"
}
}
}
/* terraform {
required_providers {
random = {
source = "hashicorp/random"
version = "3.0.1"
}
}
required_version = "~> 1.0"
} */
variable "name_length" {
description = "The number of words in the pet name"
default = "3"
}
resource "random_pet" "pet_name" {
length = var.name_length
separator = "-"
}
output "pet_name" {
value = random_pet.pet_name.id
}
但是我不断收到附件中的错误。我正在尝试使用 Terraform 1.1
知道为什么会出现此错误,即使我按原样遵循教程
cloud
在 v1.0 中不受支持。来自 docs:
Because the cloud block is not supported by older versions of Terraform, you must use 1.1.0 or higher in order to follow this tutorial.
您必须升级您的 TF。