Udostępnij za pośrednictwem


az terraform

Note

This reference is part of the terraform extension for the Azure CLI (version 2.61.0 or higher). The extension will automatically install the first time you run an az terraform command. Learn more about extensions.

This command group is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Azure Terraform experience.

Commands

Name Description Type Status
az terraform export-terraform

Exports the Terraform configuration of the specified resource(s).

Extension Preview

az terraform export-terraform

Preview

Command group 'az terraform' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Exports the Terraform configuration of the specified resource(s).

az terraform export-terraform [--export-query]
                              [--export-resource]
                              [--export-resource-group]
                              [--full-properties {0, 1, f, false, n, no, t, true, y, yes}]
                              [--mask-sensitive {0, 1, f, false, n, no, t, true, y, yes}]
                              [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                              [--target-provider {azapi, azurerm}]

Examples

Export a resource group targeting to `azurerm` provider

az terraform export-terraform --export-resource-group '{resource-group-name:my-rg}'

Export a list of resources targeting to `azapi` provider

az terraform export-terraform --full-properties false --target-provider azapi --export-resource '{resource-ids:[id1,id2,id3]}'

Export all virtual networks in the current subscription, together with their child resources (e.g. subnets) targeting `azapi` provider

az terraform export-terraform --full-properties false --target-provider azapi --export-query "{query:'type =~ \"microsoft.network/virtualnetworks\"',recursive:true}"

Optional Parameters

--export-query

Export parameter for resources queried by ARG (Azure Resource Graph). Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--export-resource

Export parameter for individual resources. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--export-resource-group

Export parameter for a resource group. Support shorthand-syntax, json-file and yaml-file. Try "??" to show more.

--full-properties

Whether to output all non-computed properties in the generated Terraform configuration? This probably needs manual modifications to make it valid.

Accepted values: 0, 1, f, false, n, no, t, true, y, yes
Default value: True
--mask-sensitive

Mask sensitive attributes in the Terraform configuration.

Accepted values: 0, 1, f, false, n, no, t, true, y, yes
Default value: True
--no-wait

Do not wait for the long-running operation to finish.

Accepted values: 0, 1, f, false, n, no, t, true, y, yes
--target-provider

The target Azure Terraform Provider.

Accepted values: azapi, azurerm
Default value: azurerm
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.