You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级Terraform AzureRM 4.x及required_provider 1.7.4时遇状态读取错误

解决Terraform AzureRM 4.x + required_provider 1.7.4升级时的schema缺失错误

升级到Terraform AzureRM 4.x版本并配合required_provider 1.7.4时,出现错误:

Error: no schema available for azurerm_template_deployment.integration_account while reading state; this is a bug in Terraform and should be reported

这是由于新版本provider与旧状态文件中的azurerm_template_deployment资源schema不兼容导致的,可通过以下步骤处理:

  • 临时回退AzureRM provider至3.x版本,执行terraform init初始化后,导出当前状态文件备份:
    terraform state pull > state-backup.json
    
  • 打开备份的状态文件,检查azurerm_template_deployment.integration_account的type和provider字段,确保与新版本provider的资源定义匹配;若该资源在AzureRM 4.x中有类型变更,手动修正为对应新类型。
  • 执行状态provider关联命令,强制同步状态与新版本provider:
    terraform state replace-provider registry.terraform.io/hashicorp/azurerm registry.terraform.io/hashicorp/azurerm -force
    
  • 重新执行provider升级:
    terraform init -upgrade
    
  • 刷新状态尝试自动修复schema匹配问题:
    terraform refresh
    
  • 若以上操作均无效,需向Terraform官方仓库提交Bug报告,提交时需附带:
    • 完整的错误日志信息
    • 升级前后的Terraform核心版本、AzureRM provider版本
    • 脱敏后的状态文件中该资源的相关片段
    • 脱敏后的Terraform配置文件片段

内容的提问来源于stack exchange,提问作者Manish

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 19:49:51