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:
- I put the code in a file called
providers.tf. - I have done some other code and did a
terraform apply, thus returning tfstate. - I did a login to Terraform Cloud using
terraform loginwith my credentials. - When I try to terraform init, the error occurs.
Any help would be much appreciated. Thank you!