Integrate with terraform-client-go for hcl only mode to eliminate terraform
binary
#381
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Integrate with terraform-client-go for hcl only mode to eliminate
terraform
binary. This improves the performance (quicker speed and lower footprint) of importing.To use it, users have to explicitly specify a new hidden flag (
--tfclient-plugin-path
). This flag is hidden since it is not supposed for CLI users to use, but is meant to be used by module users who wants to get the benefit of performance improvement.Benchmark
Following tests are done on a Dell workstation that has 8 hyperthread cores and 24G RAM. The provider is a locally built, debug, un-stripped one. The commands being run are:
aztfexport rg -n -f -hcl-only --dev-provider aztfy-vmdisk
(note the
--dev-provider
makesaztfexport
to use a local provider, which also implies to skip anyterraform init
runs)aztfexport rg -n -f -hcl-only -tfclient-plugin-path $HOME/go/bin/terraform-provider-azurerm aztfy-vmdisk
(note the
-tfclient-plugin-path
impliesaztfexport
to useterraform-client-go
instead ofterraform
binary, also it implies to using the same local provider)The scale of the resource group being exported contains a typical VM setup, with a bunch of security rules, which ends up of 30 resources in total.
cgmemtime
Running cgmemtime for 10 times for each of above command:
Old
Stat:
New
Stat: