Error: Unable to find remote state - Terraform Cloud

I’m trying to create a workspace with a remote backend but I’m getting this error:

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: Unable to find remote state
│ 
│   with data.terraform_remote_state.terraform_data,
│   on main.tf line 12, in data "terraform_remote_state" "terraform_data":
│   12: data "terraform_remote_state" "terraform_data" {
│ 
│ No stored state was found for the given workspace in the given backend.

this is my code:

data "terraform_remote_state" "terraform_data" {
    backend = "remote"
    config = {
        hostname = "app.terraform.io"
        organization = "graphul"
        workspaces = {
            name = "my-name"
        }
    }
}

Hi @SamuelBonilla,

The configuration you showed here seems syntactically correct, so I must assume that what’s going on here is a disagreement between how you’ve configured this data source and how your workspaces are set up in Terraform Cloud.

However, I cannot see how your workspaces are set up in Terraform Cloud, so unfortunately this question isn’t really a good fit for the community forum. Instead, I’d suggest contacting HashiCorp Support who can (with your consent) look directly at how you’ve configured your workspaces and hopefully notice a discrepancy that would cause this symptom, such as the workspace/organization having a different name or you not having correctly configured the access between the workspaces.

Also note that since you are using Terraform Cloud you can get a similar effect to terraform_remote_state by using the Terraform Cloud-specific tfe_outputs data source from the hashicorp/tfe provider. That data source has the advantage of using a Terraform Cloud-specific API that is tailored only to returning output values, rather than fetching the entire latest state snapshot only to take the output values, and so its access controls are less severe and so more likely to “just work” unless you’ve explicitly tightened the access controls on your workspace.

Thanks for your response, I already created a workspace through the dashboard:

Do I need to follow more steps on the dashboard after creating the workspace by hand?