id = "aztfexport" name = "Azure Export for Terraform" homepage = "https://github.com/Azure/aztfexport" description = "A tool to bring existing Azure resources under Terraform's management." executables = ["aztfexport"] platforms = ["macos", "linux"] [dotfiles] # The Microsoft project README documents the managed configuration file at # $HOME/.aztfexport/config.json. # https://github.com/Azure/aztfexport#config paths = ["~/.aztfexport/config.json"] exclude = [] secret = [] [commands] format = 1 label = "Export Azure resources to Terraform" description = "Export a resource group (or single resources) to Terraform configuration and state. Authentication, backend, query and mapping-file modes are left out." quality = "ai-draft" parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = true, short_bundles = false } [[commands.subcommand]] path = ["resource-group"] label = "Export a resource group" [[commands.subcommand.source]] id = "docs" kind = "manual" url = "https://learn.microsoft.com/en-us/azure/developer/terraform/azure-export-for-terraform/export-terraform-concepts" revision = "2026-10-27" evidence = """ aztfexport resource-group [option] aztfexport resource-group myResourceGroup aztfexport resource -o tempdir --hcl-only For a non-interactive resource, add the --non-interactive flag: aztfexport rg --non-interactive myResourceGroup. The --hcl-only flag specifies to export the configured resources to HCL If the directory in which you're running Azure Export for Terraform isn't empty, you must add the --overwrite flag to use the --hcl-only flag. aztfexport [command] --append To specify a different environment other than public cloud, use the --env flag. For example, for US Government: aztfexport [command] --env="usgovernment" [further options] aztfexport [command] --provider-name=azapi --provider-version=1.10.0 [further options] If you aren't sure what resources exist within an environment, you can verify by specifying the --generate-mapping-file flag. """ [[commands.subcommand.field]] id = "resource_group" label = "Resource group name" type = "string" position = 0 sources = ["docs"] [[commands.subcommand.field]] id = "output_dir" label = "Output directory" description = "Defaults to the current directory." type = "path" option = ["-o"] path = { kind = "directory", role = "output" } sources = ["docs"] [[commands.subcommand.field]] id = "hcl_only" label = "HCL only (no state)" description = "Generate configuration without importing resources into Terraform state." type = "boolean" option = ["--hcl-only"] sources = ["docs"] [[commands.subcommand.field]] id = "non_interactive" label = "Non-interactive" type = "boolean" option = ["--non-interactive"] sources = ["docs"] [[commands.subcommand.field]] id = "append" label = "Append to existing state" description = "Import into the existing state file and keep the output directory contents." type = "boolean" option = ["--append"] sources = ["docs"] [[commands.subcommand.field]] id = "overwrite" label = "Overwrite non-empty directory" type = "boolean" option = ["--overwrite"] effect = "overwrite" sources = ["docs"] [[commands.subcommand.field]] id = "provider_name" label = "Terraform provider" type = "string" option = ["--provider-name"] suggestions = [{ value = "azurerm", label = "AzureRM" }, { value = "azapi", label = "AzAPI" }] sources = ["docs"] [[commands.subcommand.field]] id = "provider_version" label = "Provider version" type = "string" option = ["--provider-version"] sources = ["docs"] [[commands.subcommand.field]] id = "env" label = "Cloud environment" type = "string" option = ["--env"] suggestions = [{ value = "public", label = "Public" }, { value = "usgovernment", label = "US Government" }, { value = "china", label = "China" }] sources = ["docs"] [[commands.subcommand.field]] id = "generate_mapping_file" label = "Only generate mapping file" type = "boolean" option = ["--generate-mapping-file"] sources = ["docs"] [[commands.subcommand.task]] id = "export" label = "Export interactively" fields = ["resource_group", "output_dir", "provider_name"] required = ["resource_group"] [[commands.subcommand.task]] id = "hcl" label = "Generate HCL only, unattended" set = { hcl_only = [true], non_interactive = [true] } fields = ["resource_group", "output_dir", "hcl_only", "non_interactive", "overwrite"] required = ["resource_group"] [[commands.subcommand.group]] id = "basic" label = "Basic" fields = ["resource_group", "output_dir", "hcl_only", "non_interactive"] [[commands.subcommand.group]] id = "advanced" label = "Advanced" fields = ["append", "overwrite", "provider_name", "provider_version", "env", "generate_mapping_file"]