aztfexport icon indicating copy to clipboard operation
aztfexport copied to clipboard

Feature Request - Generate config without Import

Open darren-mcdonald opened this issue 2 years ago • 1 comments

This might not be feasible depending on the order in which things are dependant on one another.

We have a situation where we have an environment that we wish to clone. This environment was originally created manually via the portal. We want to generate all the terraform code for it and ultimately run it into a different resource group.

This environment is large. When running this tool I gather it spends most of it's time importing each and every one of our hundreds of resources into a terraform state file which is something we don't need as we are not looking to take ownership of the existing resources under IaC but rather to create a new one.

Is this possible or does the Terraform code generation take place on the state file?

darren-mcdonald avatar Aug 03 '22 15:08 darren-mcdonald

@darren-mcdonald Unfortunately, the TF code is generated from the state file, which is created during the importing. This means we can't generate config without import.

Also please noted that the goal of aztfy is to generate the TF config that has no plan diff, whilst it doesn't necessarily mean you can reproduce the infra with it. There are probably some gaps between the TF config and the actual resource (e.g. some features the provider doesn't support, some O+C properties are omitted by the aztfy, etc). However, it can still be a good start point for you to modify the generated config.

magodo avatar Aug 04 '22 01:08 magodo