问题描述
我们升级了 terraform 版本,我们遇到了 terraform 远程状态的问题。 Basiacaly 我运行此命令来更新 azurerm 提供程序:
terraform state replace-provider 'registry.terraform.io/-/azurerm' 'registry.terraform.io/hashicorp/azurerm'
现在,当我运行 plan 命令时,它显示了一些错误。所有都是相同的,但如果不同则是资源。例如:
To work with module.name.module.lb_name.azurerm_lb_probe.instance
its original provider configuration at
provider["registry.terraform.io/-/azurerm"] is required,but it has been
removed. This occurs when a provider configuration is removed while objects
created by that provider still exist in the state. Re-add the provider
configuration to destroy
module.name.module.lb_name.azurerm_lb_probe.instance,after which
you can remove the provider configuration again.
基本上状态已更新,提供程序如下所示:
"provider": "provider.azurerm"
但它应该是这样的:
"provider": "provider[\"registry.terraform.io/hashicorp/azurerm\"]"
有没有办法通过 terraform 命令更新它,或者修复它的唯一方法是手动编辑状态文件?