A historically grown project with it's associated infrastructure on Azure must be split up. Luckily, it is well structured and as a result it is pretty clear that we need to move two resource groups and it's affiliated resources to a new Azure subscription.
I have checked, most of the resource can be moved, thus don't have to be created anew and data can be preserved.
For those resources that cannot be moved, luckily we are using
terraform
, which can be run to re-create those resources.The resources that need to be moved is an entire
terraform
-project, so there is no need to remove resources from the current configuration files. All of it needs to go to a new subscription.
So far so good, but now I need to understand how to practically proceed, so that terraform is aware of the moved resources. The only option I currently see is to manually move the resources on the Azure portal, change subscription on the CLI/for terraform and then run an terraform state rm; terraform import
or a terraform mv
for each of the resources.
Isn't there an easier way to achieve this? It seems overly cumbersome and basically would make it easier to just delete the entire infrastructure in the current subscription and recreate it via terraform in the new subscription (not an option!)