Pallab
Pallab

Reputation: 2325

Getting Error while initializing Terraform with version 1.1

I am trying to migrate my local state file to TF Cloud by following this link :

https://learn.hashicorp.com/tutorials/terraform/cloud-migrate?in=terraform/cloud

I already have my workspace and i have logged in to TF Cloud from the CMD Line using the API token that i got. My code is shown below

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
}

But i get the error constantly as attached. I am trying to use Terraform 1.1 Any idea why this error is coming even though i am following the tutorial as it isenter image description here

Upvotes: 1

Views: 171

Answers (1)

Marcin
Marcin

Reputation: 238081

cloud is not supported in v1.0. From 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.

You have to upgrade your TF.

Upvotes: 1

Related Questions