首页 > 解决方案 > Terraform 后端到 azure blob 存储错误

问题描述

我一直在使用以下内容在 Azure 存储中成功创建 terraform 的后端状态文件,但由于某种原因它停止工作。我已经回收了存储密码,尝试了两个密钥并且每次都得到相同的错误

后端.tf

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

返回错误

terraform init
正在初始化后端...
成功配置后端“azurerm”!除非后端配置发生更改,否则 Terraform 将自动使用此后端。
刷新状态时出错:存储:服务返回错误:StatusCode=403,ErrorCode=AuthenticationFailed,ErrorMessage=Server 未能对请求进行身份验证。确保 Authorization 标头的值正确形成,包括签名。RequestId:665e0067-b01e-007a-6084-97da67000000
时间:2018-12-19T10:18:18.7148241Z,RequestInitiated=周三,2018 年 12 月 19 日 10:18:18 GMT,RequestId=665e0067-b01e-067000-60804-7 API 版本=,QueryParameterName=,QueryParameterValue=

任何想法我做错了什么?

标签: azureterraform

解决方案


对我有用的是删除本地 .terraform 文件夹并重试。


推荐阅读