I Cakramurti
I Cakramurti

Reputation: 299

Blocks of type "cloud" are not expected here for integrating with Terraform Cloud

I'm following this documentation in migrating the local state to be integrated with Terraform Cloud.

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

It is fairly straightforward, I just need to copy this code:

terraform {
  required_version = ">= 1.1.0"
  required_providers {
    random = {
      source  = "hashicorp/random"
      version = "3.0.1"
    }
  }
  cloud {
    organization = "<ORG_NAME>"
    workspaces {
      name = "Example-Workspace"
    }
  }
}

The problem is that my code below has the same code with above

terraform {
  required_version = ">= 0.14.9"
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "~> 3.27"
    }
  }
  cloud {
    organization = "ORG"

    workspaces {
      name = "ORG_WORKSPACE"
    }
  }
}

But it is returning an error:

Blocks of type "cloud" are not expected here.

Some notes:

  1. I put the code in a file called providers.tf.
  2. I have done some other code and did a terraform apply, thus returning tfstate.
  3. I did a login to Terraform Cloud using terraform login with my credentials.
  4. When I try to terraform init, the error occurs.

Any help would be much appreciated. Thank you!

Upvotes: 3

Views: 3235

Answers (1)

Marcin
Marcin

Reputation: 238081

cloud is only supported in TF 1.1.0, not any older version. 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 0.14 to the newest version.

Upvotes: 5

Related Questions