【问题标题】:Getting Error while initializing Terraform with version 1.1使用 1.1 版初始化 Terraform 时出错
【发布时间】:2022-01-18 07:30:39
【问题描述】:

我正在尝试通过以下链接将我的本地状态文件迁移到 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 知道为什么会出现这个错误,即使我按照教程进行操作

【问题讨论】:

  • 你能仔细检查你的版本吗:tf -version
  • @Marcin 哦,它是 1.0.0。这是这个错误的原因吗?

标签: terraform terraform0.12+


【解决方案1】:

cloud 在 v1.0 中不受支持。来自docs

由于旧版本的 Terraform 不支持云块,您必须使用 1.1.0 或更高版本才能学习本教程。

你必须升级你的TF。

【讨论】:

    猜你喜欢
    • 2021-11-13
    • 1970-01-01
    • 1970-01-01
    • 2016-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多