I have a backend.tf file that has some initial configurations for an azurem remote backend just like this where my current statefile is stored
terraform {
backend "azurerm" {
resource_group_name = "fakeresource-Name"
storage_account_name = "fakeAccountName"
container_name = "fakeContainer"
key = "fakeName.tfstate"
}
}
The access key is set as an environment variable ARM_ACCESS_KEY.
I want to now move the statefile to a completely different storage account, which I do by running terraform init with new -backend-configs like
terraform init -backend-config="key=fakeName.tfstate" -backend-config="resource_group_name=fakeResource-Name2" -backend-config="storage_account_name=fakeStorageName2" -backend-config="container_name=fakeContainer2"
I have also made sure to change the environment variable of ARM_ACCESS_KEY with the access key of the new storage account. However when I run this terraform command I get an AuthenticationFailed error.
containers.Client#ListBlobs: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: Service returned an error. Status=403 Code="AuthenticationFailed" Message="Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.