I am working on migrating a ton of modules from 0.11.4 to 0.13.6. I have deliberately not chosen directly to jump to 0.14 as there are some breaking changes, moving to 0.14 and then 0.15 are my next goals.
The problem is that a handful of modules have been deleted from terraform configuration files without using terraform destroy
Now, the modules information is in terraform state but the actual files are lost. If I had those files, I would have used the provider specifically in the modules and fixed (like I have done with a lot of other modules).
# This is just an example, I have quite a few of these :( To work with module.vault.data.aws_route53_zone.hosted_zone its original provider configuration at module.vault.provider["registry.terraform.io/hashicorp/aws"].R53 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.vault.data.aws_route53_zone.hosted_zone, after which you can remove the provider configuration again.
❯ terraform version Terraform v0.13.6 + provider registry.terraform.io/-/random v3.1.0 + provider registry.terraform.io/hashicorp/aws v3.30.0 + provider registry.terraform.io/hashicorp/external v2.1.0 + provider registry.terraform.io/hashicorp/null v3.1.0 + provider registry.terraform.io/hashicorp/random v3.1.0 + provider registry.terraform.io/hashicorp/template v2.2.0
I know it is not recommended but can I just pull the state file and remove all JSON blocks of
"module": "module.vault", or run
terraform state rm on the modules.
I know it is not recommended way but I can’t think of anything else at the moment as I do not have the files anymore.