-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
285 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# [Command] _azure-terraform export-terraform_ | ||
|
||
Exports the Terraform configuration of the specified resource(s) | ||
|
||
## Versions | ||
|
||
### [2023-07-01-preview](/Resources/mgmt-plane/L3N1YnNjcmlwdGlvbnMve30vcHJvdmlkZXJzL21pY3Jvc29mdC5henVyZXRlcnJhZm9ybS9leHBvcnR0ZXJyYWZvcm0=/2023-07-01-preview.xml) **Preview** | ||
|
||
<!-- mgmt-plane /subscriptions/{}/providers/microsoft.azureterraform/exportterraform 2023-07-01-preview --> | ||
|
||
#### examples | ||
|
||
- Export a resource group targeting to `azurerm` provider | ||
```bash | ||
azure-terraform export-terraform --export-resource-group '{resource-group-name:my-rg}' | ||
``` | ||
|
||
- Export a list of resources targeting to `azapi` provider | ||
```bash | ||
azure-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 | ||
```bash | ||
azure-terraform export-terraform --full-properties false --target-provider azapi --export-query "{query:'type =~ \"microsoft.network/virtualnetworks\"',recursive:true}" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# [Group] _azure-terraform_ | ||
|
||
Azure Terraform experience | ||
|
||
## Commands | ||
|
||
- [export-terraform](/Commands/azure-terraform/_export-terraform.md) | ||
: Exports the Terraform configuration of the specified resource(s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...vdmlkZXJzL21pY3Jvc29mdC5henVyZXRlcnJhZm9ybS9leHBvcnR0ZXJyYWZvcm0=/2023-07-01-preview.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"plane": "mgmt-plane", "resources": [{"id": "/subscriptions/{}/providers/microsoft.azureterraform/exportterraform", "version": "2023-07-01-preview", "swagger": "mgmt-plane/terraform/ResourceProviders/Microsoft.AzureTerraform/Paths/L3N1YnNjcmlwdGlvbnMve3N1YnNjcmlwdGlvbklkfS9wcm92aWRlcnMvTWljcm9zb2Z0LkF6dXJlVGVycmFmb3JtL2V4cG9ydFRlcnJhZm9ybQ==/V/MjAyMy0wNy0wMS1wcmV2aWV3"}], "commandGroups": [{"name": "azure-terraform", "commands": [{"name": "export-terraform", "version": "2023-07-01-preview", "resources": [{"id": "/subscriptions/{}/providers/microsoft.azureterraform/exportterraform", "version": "2023-07-01-preview", "swagger": "mgmt-plane/terraform/ResourceProviders/Microsoft.AzureTerraform/Paths/L3N1YnNjcmlwdGlvbnMve3N1YnNjcmlwdGlvbklkfS9wcm92aWRlcnMvTWljcm9zb2Z0LkF6dXJlVGVycmFmb3JtL2V4cG9ydFRlcnJhZm9ybQ==/V/MjAyMy0wNy0wMS1wcmV2aWV3"}], "argGroups": [{"name": "", "args": [{"type": "SubscriptionId", "var": "$Path.subscriptionId", "options": ["subscription"], "required": true, "idPart": "subscription"}]}, {"name": "ExportParameter", "args": [{"type": "object", "var": "$exportParameter.ExportQuery", "options": ["export-query"], "group": "ExportParameter", "help": {"short": "Export parameter for resources queried by ARG (Azure Resource Graph)."}, "args": [{"type": "string", "var": "$exportParameter.ExportQuery.namePattern", "options": ["name-pattern"], "help": {"short": "The name pattern of the Terraform resources"}, "default": {"value": "res-"}}, {"type": "string", "var": "$exportParameter.ExportQuery.query", "options": ["query"], "required": true, "help": {"short": "The ARG where predicate. Note that you can combine multiple conditions in one `where` predicate, e.g. `resourceGroup =~ \"my-rg\" and type =~ \"microsoft.network/virtualnetworks\"`"}}, {"type": "boolean", "var": "$exportParameter.ExportQuery.recursive", "options": ["recursive"], "help": {"short": "Whether to recursively list child resources of the query result"}, "default": {"value": false}}]}, {"type": "object", "var": "$exportParameter.ExportResource", "options": ["export-resource"], "group": "ExportParameter", "help": {"short": "Export parameter for individual resources."}, "args": [{"type": "string", "var": "$exportParameter.ExportResource.namePattern", "options": ["name-pattern"], "help": {"short": "The name pattern of the Terraform resources"}, "default": {"value": "res-"}}, {"type": "array<string>", "var": "$exportParameter.ExportResource.resourceIds", "options": ["resource-ids"], "required": true, "help": {"short": "The id of the resource to be exported"}, "item": {"type": "string"}}, {"type": "string", "var": "$exportParameter.ExportResource.resourceName", "options": ["resource-name"], "help": {"short": "The Terraform resource name. Only works when `resourceIds` contains only one item."}, "default": {"value": "res-0"}}, {"type": "string", "var": "$exportParameter.ExportResource.resourceType", "options": ["resource-type"], "help": {"short": "The Terraform resource type. Only works when `resourceIds` contains only one item."}}]}, {"type": "object", "var": "$exportParameter.ExportResourceGroup", "options": ["export-resource-group"], "group": "ExportParameter", "help": {"short": "Export parameter for a resource group."}, "args": [{"type": "string", "var": "$exportParameter.ExportResourceGroup.namePattern", "options": ["name-pattern"], "help": {"short": "The name pattern of the Terraform resources"}, "default": {"value": "res-"}}, {"type": "string", "var": "$exportParameter.ExportResourceGroup.resourceGroupName", "options": ["resource-group-name"], "required": true, "help": {"short": "The name of the resource group to be exported"}}]}, {"type": "boolean", "var": "$exportParameter.fullProperties", "options": ["full-properties"], "group": "ExportParameter", "help": {"short": "Whether to output all non-computed properties in the generated Terraform configuration? This probably needs manual modifications to make it valid"}, "default": {"value": true}}, {"type": "boolean", "var": "$exportParameter.maskSensitive", "options": ["mask-sensitive"], "group": "ExportParameter", "help": {"short": "Mask sensitive attributes in the Terraform configuration"}, "default": {"value": true}}, {"type": "string", "var": "$exportParameter.targetProvider", "options": ["target-provider"], "group": "ExportParameter", "help": {"short": "The target Azure Terraform Provider"}, "default": {"value": "azurerm"}, "enum": {"items": [{"name": "azapi", "value": "azapi"}, {"name": "azurerm", "value": "azurerm"}]}}]}], "operations": [{"longRunning": {"finalStateVia": "azure-async-operation"}, "operationId": "ExportTerraform", "http": {"path": "/subscriptions/{subscriptionId}/providers/Microsoft.AzureTerraform/exportTerraform", "request": {"method": "post", "path": {"params": [{"type": "uuid", "name": "subscriptionId", "arg": "$Path.subscriptionId", "required": true}]}, "query": {"consts": [{"readOnly": true, "const": true, "default": {"value": "2023-07-01-preview"}, "type": "string", "name": "api-version", "required": true, "format": {"minLength": 1}}]}, "body": {"json": {"schema": {"type": "object", "name": "exportParameter", "required": true, "props": [{"default": {"value": true}, "type": "boolean", "name": "fullProperties", "arg": "$exportParameter.fullProperties"}, {"default": {"value": true}, "type": "boolean", "name": "maskSensitive", "arg": "$exportParameter.maskSensitive"}, {"default": {"value": "azurerm"}, "type": "string", "name": "targetProvider", "arg": "$exportParameter.targetProvider", "enum": {"items": [{"value": "azapi"}, {"value": "azurerm"}]}}, {"type": "string", "name": "type", "required": true, "enum": {"items": [{"arg": "$exportParameter.ExportQuery", "value": "ExportQuery"}, {"arg": "$exportParameter.ExportResource", "value": "ExportResource"}, {"arg": "$exportParameter.ExportResourceGroup", "value": "ExportResourceGroup"}]}}], "discriminators": [{"property": "type", "value": "ExportQuery", "props": [{"default": {"value": "res-"}, "type": "string", "name": "namePattern", "arg": "$exportParameter.ExportQuery.namePattern"}, {"type": "string", "name": "query", "arg": "$exportParameter.ExportQuery.query", "required": true}, {"default": {"value": false}, "type": "boolean", "name": "recursive", "arg": "$exportParameter.ExportQuery.recursive"}]}, {"property": "type", "value": "ExportResource", "props": [{"default": {"value": "res-"}, "type": "string", "name": "namePattern", "arg": "$exportParameter.ExportResource.namePattern"}, {"type": "array<string>", "name": "resourceIds", "arg": "$exportParameter.ExportResource.resourceIds", "required": true, "item": {"type": "string"}}, {"default": {"value": "res-0"}, "type": "string", "name": "resourceName", "arg": "$exportParameter.ExportResource.resourceName"}, {"type": "string", "name": "resourceType", "arg": "$exportParameter.ExportResource.resourceType"}]}, {"property": "type", "value": "ExportResourceGroup", "props": [{"default": {"value": "res-"}, "type": "string", "name": "namePattern", "arg": "$exportParameter.ExportResourceGroup.namePattern"}, {"type": "string", "name": "resourceGroupName", "arg": "$exportParameter.ExportResourceGroup.resourceGroupName", "required": true}]}], "clientFlatten": true}}}}, "responses": [{"statusCode": [202], "header": {"items": [{"name": "Azure-AsyncOperation"}, {"name": "Location"}, {"name": "Retry-After"}]}}, {"statusCode": [200, 201], "body": {"json": {"var": "$Instance", "schema": {"type": "object", "props": [{"readOnly": true, "type": "dateTime", "name": "endTime"}, {"type": "object", "name": "error", "props": [{"readOnly": true, "type": "array<object>", "name": "additionalInfo", "item": {"type": "object", "props": [{"readOnly": true, "type": "object", "name": "info", "additionalProps": {"readOnly": true, "anyType": true}}, {"readOnly": true, "type": "string", "name": "type"}]}}, {"readOnly": true, "type": "string", "name": "code"}, {"readOnly": true, "type": "array<@ErrorDetail_read>", "name": "details", "item": {"type": "@ErrorDetail_read"}, "identifiers": ["target", "message"]}, {"readOnly": true, "type": "string", "name": "message"}, {"readOnly": true, "type": "string", "name": "target"}], "cls": "ErrorDetail_read"}, {"type": "string", "name": "id"}, {"type": "string", "name": "name"}, {"type": "float64", "name": "percentComplete"}, {"type": "object", "name": "properties", "props": [{"type": "string", "name": "configuration"}, {"type": "array<@ErrorDetail_read>", "name": "errors", "item": {"type": "@ErrorDetail_read"}}, {"type": "array<string>", "name": "skippedResources", "item": {"type": "string"}}]}, {"readOnly": true, "type": "dateTime", "name": "startTime"}, {"type": "string", "name": "status"}]}}}}, {"isError": true, "body": {"json": {"schema": {"type": "@MgmtErrorFormat"}}}}]}}], "outputs": [{"type": "object", "ref": "$Instance", "clientFlatten": true}], "confirmation": ""}]}]} |
Oops, something went wrong.