When I try to upgrade terraform and cdktf for python, it is deleting all the resources and recreating them from cdktf plan output.
The Ids are changed. Is there anyway to force to use old style Ids? There are certain resources like eventhub’s and Log Analytics Workspace I can not afford to delete and recreate.
terraform – v1.2.5
cdktf – v0.11.2
azurerm – v3.35.0
terraform – v1.5.3
cdktf – v0.17.1
azurerm – v3.64.0
That is probably due to the removal of the features flag that happened in that release.
It is possible to override resources with an explicit id by calling
.overrideLogicalId("the_old_id") on the specific resources as a quick way of getting rid of these proposed changes. The alternative would be to use
terraform state mv commands in the output directory of the stack to move the state to the new ids.
Thanks a lot Ansgar. But I have a question on where to run ‘terraform state mv …’ from? Is it from old version stack or new version stack?
You would run that on the synth output of the new version stack (the one that has the plan output that wants to move all resources).