Terraform: Error: Provider configuration not present. Module gets created, but when I remove or comment it throws an error

36 views Asked by At

So I'm using terraform module where the source is another internal git repository. I can successfully create resources using the module, but when I try to remove(or comment) the module does not get removed. It throws an error. However, when I use terraform destroy command, I can remove this module via the command line. However it's hard to recognize a code removal and run terraform destroy command in a CI/CD pipeline. Is there a workaround for this? The error message is as follows,

Error: Provider configuration not present

To work with module.foo (orphan) its original provider configuration at module.foo.provider["registry.terraform.io/datadog/datadog"] 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.foo (orphan), after which you can remove the provider configuration again.
0

There are 0 answers