Backend artifactory No stored state was found for the given workspace in the given backend

Has anyone had this error:

Error: Unable to find remote state

on backend.tf line 11, in data “terraform_remote_state” “foo”:
11: data “terraform_remote_state” “foo” {

No stored state was found for the given workspace in the given backend.

cat backend.tf:
terraform {
backend “artifactory” {
username = “xxxxx”
password = “xxxxxx”
url = “https://artifactory.xxxxx.com.xx/artifactory
repo = “terraform-tf-state”
subpath = “xxx”
}
}

data “terraform_remote_state” “foo” {
backend = “artifactory”
config = {
username = “xxxxx”
password = “xxxxxx”
url = “https://artifactory.xxxx.com.xx/artifactory
repo = “terraform-tf-state”
subpath = “xxx”
}
}

In artifactory has already created the generic repository with the name of terraform-tf-state and the user has full access.
PS: There is no subpath, I hope it will be created when saving tfstate in the repository.

I would like to save tfstates to an artifactory repository. Any ideas on this problem?

So, I removed information on backend.tf:

data “terraform_remote_state” “foo” {
backend = “artifactory”
config = {
username = “xxxxx”
password = “xxxxxx”
url = “https://artifactory.xxxx.com.xx/artifactory”
repo = “terraform-tf-state”
subpath = “xxx”
}
}

And manually create subpath “xxx” in the artifactory repository.
Then after execute:
terraform init
terraform apply

The tfstate file was uploaded to artifactory repository.
Sucess !