Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terraform back-end to azure blob storage errors

I have been using the below to successfully create a back-end state file for terraform in Azure storage, but for some reason its stopped working. I've recycled passwords for the storage, trying both keys and get the same error every-time

backend.tf

    terraform {
    backend "azurerm" {
        storage_account_name    = "terraformstorage"
        resource_group_name     = "automation"
        container_name          = "terraform" 
        key                     = "testautomation.terraform.tfstate"
        access_key              = "<storage key>"
    }
}

Error returned

terraform init
Initializing the backend...
Successfully configured the backend "azurerm"! Terraform will automatically use this backend unless the backend configuration changes.
Error refreshing state: storage: service returned error: StatusCode=403, ErrorCode=AuthenticationFailed, ErrorMessage=Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature. RequestId:665e0067-b01e-007a-6084-97da67000000
Time:2018-12-19T10:18:18.7148241Z, RequestInitiated=Wed, 19 Dec 2018 10:18:18 GMT, RequestId=665e0067-b01e-007a-6084-97da67000000, API Version=, QueryParameterName=, QueryParameterValue=

Any ideas what im doing wrong?

like image 262
Staggerlee011 Avatar asked Dec 19 '18 10:12

Staggerlee011


People also ask

What does the default local Terraform backend store?

By default, Terraform uses a backend called local , which stores state as a local file on disk.

Where are Tfstate files stored?

The state file is commonly stored either on a local machine, in a remote storage location (like a storage account in Azure, or S3 bucket in AWS), or in Terraform cloud. By default, it is stored on the local machine and is named “terraform. tfstate”.


1 Answers

What worked for me is to delete the local .terraform folder and try again.

like image 113
vgaltes Avatar answered Sep 19 '22 01:09

vgaltes