我正在重构一些 Terraform 模块,但出现了以下问题:
Error: Provider configuration not present
To work with
module.my_module.some_resource.resource_name its
original provider configuration at
module.my_module.provider.some_provider.provider_name 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.my_module.some_resource.resource_name, after
which you can remove the provider configuration again.
看起来我需要从tfstate文件中删除该资源,然后使用新的tf配置重新添加它。
当我重构一些单块代码时,有数百个这样的 Error: Provider configuration not present
消息。
有什么快捷方式可以进行删除和重新添加吗?
terraform state rm module.my_module.some_resource.resource_name
。 - Ikar Pohorský