Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 779
I Cakramurti Avatar asked Feb 01 '26 14:02

I Cakramurti


1 Answers

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.

like image 62
Marcin Avatar answered Feb 04 '26 07:02

Marcin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!