aztfexport icon indicating copy to clipboard operation
aztfexport copied to clipboard

Ability to import entire subscription

Open cedrox opened this issue 4 years ago • 3 comments

Would be interesting to get full subscription as terraform project in one shot

cedrox avatar Oct 13 '21 21:10 cedrox

@cedrox Thank you for this feature request! aztfy leverages the ARM to learn the cross resource dependencies. Unfortunately, there is no way to export an ARM template for a whole subscription for now.

Alternatively, you can try out tfadd (also used by aztfy under the hood), together with the terraform import to do a finer grained import for whatever you want. It generate the cfg the same way as aztfy, with only one caveate: there is no cross resource dependency generated, you'll have to add it by yourself.

Hope this helps.

magodo avatar Apr 13 '22 07:04 magodo

Not to be contrarian but if we're looking to import 500 resource groups within one subscription, it really doesn't matter how aztfy translates from ARM to Terraform. Without the ability to cover subscription scopes, the onus falls on us to find a way to loop through RGs individually until issue #28 is completed.

As a workaround idea, is there some way to have aztfy check within the subscription scope that a user has already set via az account set --subscription %subscriptionNameGoesHere% to query all available RGs, then run them through the interface or non-interactive mode as it already does?

MohnJadden avatar Jul 20 '22 19:07 MohnJadden

@MohnJadden That is possible, however, one major problem of that is that we are importing the rg one by one, which means the ARM template is still in scope of one RG. This results into the combined ARM templates will miss the cross RG dependencies.

magodo avatar Jul 21 '22 01:07 magodo