Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support new command az azure-terraform #554

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Commands/azure-terraform/_export-terraform.md
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}"
```
8 changes: 8 additions & 0 deletions Commands/azure-terraform/readme.md
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)
3 changes: 3 additions & 0 deletions Commands/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
- [automation](/Commands/automation/readme.md)
: Manage Automation Account.

- [azure-terraform](/Commands/azure-terraform/readme.md)
: Azure Terraform experience

- [baremetalinstance](/Commands/baremetalinstance/readme.md)
: Handle Operations for Compute Azure Bare Instances.

Expand Down
52 changes: 52 additions & 0 deletions Commands/tree.json
Original file line number Diff line number Diff line change
Expand Up @@ -11113,6 +11113,58 @@
"automation"
]
},
"azure-terraform": {
"commands": {
"export-terraform": {
"help": {
"short": "Exports the Terraform configuration of the specified resource(s)"
},
"names": [
"azure-terraform",
"export-terraform"
],
"versions": [
{
"examples": [
{
"commands": [
"azure-terraform export-terraform --export-resource-group '{resource-group-name:my-rg}'"
],
"name": "Export a resource group targeting to `azurerm` provider"
},
{
"commands": [
"azure-terraform export-terraform --full-properties false --target-provider azapi --export-resource '{resource-ids:[id1,id2,id3]}'"
],
"name": "Export a list of resources targeting to `azapi` provider"
},
{
"commands": [
"azure-terraform export-terraform --full-properties false --target-provider azapi --export-query \"{query:'type =~ \\\"microsoft.network/virtualnetworks\\\"',recursive:true}\""
],
"name": "Export all virtual networks in the current subscription, together with their child resources (e.g. subnets) targeting `azapi` provider"
}
],
"name": "2023-07-01-preview",
"resources": [
{
"id": "/subscriptions/{}/providers/microsoft.azureterraform/exportterraform",
"plane": "mgmt-plane",
"version": "2023-07-01-preview"
}
],
"stage": "Preview"
}
]
}
},
"help": {
"short": "Azure Terraform experience"
},
"names": [
"azure-terraform"
]
},
"baremetalinstance": {
"commands": {
"create": {
Expand Down
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": ""}]}]}
Loading
Loading