Azure/aztfexport

Question: Current difference between aztfexport & official Terraform 1.5.0-beta2 configuration generator?

Closed this issue · 2 comments

Hi, just wanted to ask what is the current difference in generated HCL code given the fact that the latest beta realease of Terraform now finally has this long anticipated and similar functionality? When using import blocks as part of the configuration in .tf files and terraform plan -generate-config-out=PATH it imports already existing cloud infrastructure mentioned in the import block and generates the HCL code in similar manner like aztfexport so I just wanted to know if the roots of this functionality is the same for both of them or the quality varies? Has anyone compared them yet? I'm asking only about the end quality of the imported configuration atm.

magodo commented

@majorku5anagi Thank you for asking this! There are following nuances of the aztfexport generated configurations comparing to terraform plannable import:

  1. The generated configuration is provider schema aware, which ideally make the configuration to be "valid". See https://github.com/magodo/tfadd#intro and https://github.com/magodo/tfpluginschema for details. While the "plannable import" is only aware of the core schema, which has less information than needed to generate a valid config, which means users will likely have to modify the config before it can be used.
  2. The generated configuration has dependency injected based on the Azure resource id relationships. This is something "plannable import" can't afford since it only has "Terraform" resource id, which might not be the same as its Azure id sometimes.

Whilst, aztfexport can also play well together with "plannable import". "plannable import" is not good at discovering resources today, which in contrast is what aztfexport good at. In which case, with #398 merged, users can use aztfexport to discover resources and generate the import blocks, and then consume it via "plannable import".

To further add on to what @magodo has mentioned, we were and are continuing to work closely with HashiCorp in regards to their plannable import functionality. The hope is that both parties can benefit from both solutions to make all of you enjoy a smoother experience on Terraform for Azure.