I have the same problem described above by @Deekshit Kumar. I'm using Terraform version 0.12.23 and Azure Provider 2.0.0.
The relevant part of my main.tf
data "terraform_remote_state" "storage" {
backend = "azurerm"
config = {
storage_account_name = var.tfstate_sta_name
container_name = var.tfstate_container_name
subscription_id = var.tfstate_subscription_id
access_key = var.tfstate_accesskey
key = var.tfstate_storage_file
}
}
terraform {
backend "azurerm" {}
}
If I run the command...
terraform init \
-backend-config 'storage_account_name=<account-name>' \
-backend-config 'container_name=<container-name>' \
-backend-config 'access_key=<access-key>' \
-backend-config 'key=<file-name>'
...a block blob mit 0B is created in the Azure Storage.
After executing the command...
terraform apply -auto-approve \
-var 'tfstate_accesskey=<access-key>' \
-var 'tfstate_sta_name=<account-name>' \
-var 'tfstate_subscription_id=<subscription-id>' \
-var 'tfstate_container_name=<container-name>' \
-var 'tfstate_storage_file=<file-name>'
... I get the following error:
Unable to find remote state
on .build/main.tf line 29, in data "terraform_remote_state" "storage":
29: data "terraform_remote_state" "storage"
No stored state was found for the given workspace in the given backend.
Does anyone have a solution for this?