az terraform
注释
此参考是 Azure CLI 的 terraform 扩展(版本 2.61.0 或更高版本)的一部分。 该扩展将在首次运行 az terraform 命令时自动安装。 了解更多关于扩展 的相关信息。
此命令组处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus
Azure Terraform 体验。
命令
名称 | 说明 | 类型 | Status |
---|---|---|---|
az terraform export-terraform |
导出指定资源的 Terraform 配置。 |
扩展 | 预览 |
az terraform export-terraform
命令组“az terraform”处于预览状态,正在开发中。 参考和支持级别:https://aka.ms/CLI_refstatus
导出指定资源的 Terraform 配置。
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}]
示例
将目标为“azurerm”提供程序的资源组导出
az terraform export-terraform --export-resource-group '{resource-group-name:my-rg}'
将目标为“azapi”提供程序的资源列表
az terraform export-terraform --full-properties false --target-provider azapi --export-resource '{resource-ids:[id1,id2,id3]}'
导出当前订阅中的所有虚拟网络及其子资源(例如子网)以“azapi”提供程序为目标
az terraform export-terraform --full-properties false --target-provider azapi --export-query "{query:'type =~ \"microsoft.network/virtualnetworks\"',recursive:true}"
可选参数
ARG(Azure Resource Graph)查询的资源的导出参数。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
导出单个资源的参数。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
导出资源组的参数。 支持速记语法、json-file 和 yaml-file。 请尝试“??” 以显示更多内容。
是否输出生成的 Terraform 配置中的所有非计算属性? 这可能需要手动修改才能使其有效。
在 Terraform 配置中屏蔽敏感属性。
不等待长时间运行的操作完成。
目标 Azure Terraform 提供程序。
全局参数
提高日志记录详细程度以显示所有调试日志。
显示此帮助消息并退出。
仅显示错误,禁止显示警告。
输出格式。
JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/。
订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID
配置默认订阅。
增加日志记录详细程度。 使用 --debug 获取完整的调试日志。