Hello,
I’m a bit new to TF so not sure if I’m missing something obvious.
I am using a library of TF modules stored in GitHub. An AWS serviceX TF module was used to deploy an instance of serviceX. The serviceX module calls an AWS KMS TF submodule to enable encryption. KMS encryption is required by the serviceX TF module. No issues with the deployment, everything worked as expected.
The instance of serviceX was created for testing purposes, is no longer necessary and needs to be destroyed. By removing all references to instance of serviceX in the TF manifests, I encounter the below error message during plan (kms provider is defined in the submodule):
Error: Provider configuration not present
To work with module.serviceX.module.kms.anyKmsResource its original provider configuration at module.serviceX.provider.aws.kms is required but it has been removed.
Re-add the provider configuration to destroy module.serviceX.module.kms.anyKmsResource, after which you can remove the provider configuration again.
While I understand the explanation in the error message, I’m not quite sure the best way to solve the issue. The module that TF wants requires KMS so I cannot remove all the KMS related resources as a first step.
The only solution I can think of is to temporarily modify the serviceX module to not require KMS, destroy the KMS related resources as a first step, and then destroy module.serviceX as a second step.
But that seems a bit excessive, is there a better way? Is it possible to simply add a KMS provider reference at the root (based on the wording of the error message probably not)?
Thanks.