terraform module upgrade and manage 'plan differencies'

33 views Asked by At

I defined a module that has all the related grafana, resources. And used this module in many root modules.

But there was some misconfiguration of the 'grafana provider version' and I changed all of the module's resources to not use deprecated methods. And attached a tag on it as the newer version of this module.

I upgraded this module step-by-step with one root module to check the behavior of this module and not to cause diffs when I apply this. Because it has nothing to change in real. Only the configuration code should change.

The root module I applied step-by-step doesn't show any diffs when I command 'terraform plan'. But If I let other root modules to source this newer module, then lots of diff show up to me.

What can I do to solve this? I thought terraform state rm and terraform import [address] [id] could solve this. Deleting the current state and importing existing resources to addresses of the newer module. But. there are lots of resources in this module, and I don't know the exact id of these resources for each. I could do this one-by-one manually, but this is so exhaustive. Is there any good way to solve this?

p.s. I'm using git tags in the module source as below.

module "grafana" {
-  source       = "[email protected]:test.git//modules/grafana?ref=grafana-v1.1.0"
+  source       = "[email protected]:test.git//modules/grafana?ref=grafana-v2.0.0"
}
0

There are 0 answers