From d478f441c8ef526034bcce1be2e4de5afbc28b14 Mon Sep 17 00:00:00 2001 From: magodo Date: Wed, 25 Sep 2024 17:08:50 +0800 Subject: [PATCH 1/2] Support new command `az terraform` --- src/service_name.json | 5 + src/terraform/HISTORY.rst | 8 + src/terraform/README.md | 5 + src/terraform/azext_terraform/__init__.py | 42 ++ src/terraform/azext_terraform/_help.py | 11 + src/terraform/azext_terraform/_params.py | 13 + src/terraform/azext_terraform/aaz/__init__.py | 6 + .../azext_terraform/aaz/latest/__init__.py | 10 + .../aaz/latest/terraform/__cmd_group.py | 24 ++ .../aaz/latest/terraform/__init__.py | 12 + .../aaz/latest/terraform/_export_terraform.py | 388 ++++++++++++++++++ .../azext_terraform/azext_metadata.json | 4 + src/terraform/azext_terraform/commands.py | 15 + src/terraform/azext_terraform/custom.py | 14 + .../azext_terraform/tests/__init__.py | 6 + .../azext_terraform/tests/latest/__init__.py | 6 + .../tests/latest/test_terraform.py | 13 + src/terraform/setup.cfg | 1 + src/terraform/setup.py | 49 +++ 19 files changed, 632 insertions(+) create mode 100644 src/terraform/HISTORY.rst create mode 100644 src/terraform/README.md create mode 100644 src/terraform/azext_terraform/__init__.py create mode 100644 src/terraform/azext_terraform/_help.py create mode 100644 src/terraform/azext_terraform/_params.py create mode 100644 src/terraform/azext_terraform/aaz/__init__.py create mode 100644 src/terraform/azext_terraform/aaz/latest/__init__.py create mode 100644 src/terraform/azext_terraform/aaz/latest/terraform/__cmd_group.py create mode 100644 src/terraform/azext_terraform/aaz/latest/terraform/__init__.py create mode 100644 src/terraform/azext_terraform/aaz/latest/terraform/_export_terraform.py create mode 100644 src/terraform/azext_terraform/azext_metadata.json create mode 100644 src/terraform/azext_terraform/commands.py create mode 100644 src/terraform/azext_terraform/custom.py create mode 100644 src/terraform/azext_terraform/tests/__init__.py create mode 100644 src/terraform/azext_terraform/tests/latest/__init__.py create mode 100644 src/terraform/azext_terraform/tests/latest/test_terraform.py create mode 100644 src/terraform/setup.cfg create mode 100644 src/terraform/setup.py diff --git a/src/service_name.json b/src/service_name.json index 689bc46a86f..675bda65786 100644 --- a/src/service_name.json +++ b/src/service_name.json @@ -619,6 +619,11 @@ "AzureServiceName": "Azure Support", "URL": "https://azure.microsoft.com/support/options" }, + { + "Command": "az terraform", + "AzureServiceName": "AzureTerraform", + "URL": "" + }, { "Command": "az trustedsigning", "AzureServiceName": "Trusted signing service", diff --git a/src/terraform/HISTORY.rst b/src/terraform/HISTORY.rst new file mode 100644 index 00000000000..abbff5a61a7 --- /dev/null +++ b/src/terraform/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +1.0.0b1 +++++++ +* Initial release. \ No newline at end of file diff --git a/src/terraform/README.md b/src/terraform/README.md new file mode 100644 index 00000000000..5d9e3b3aa52 --- /dev/null +++ b/src/terraform/README.md @@ -0,0 +1,5 @@ +# Azure CLI Terraform Extension # +This is an extension to Azure CLI to manage Terraform resources. + +## How to use ## +Please add commands usage here. \ No newline at end of file diff --git a/src/terraform/azext_terraform/__init__.py b/src/terraform/azext_terraform/__init__.py new file mode 100644 index 00000000000..07afed834ab --- /dev/null +++ b/src/terraform/azext_terraform/__init__.py @@ -0,0 +1,42 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader +from azext_terraform._help import helps # pylint: disable=unused-import + + +class TerraformCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + custom_command_type = CliCommandType( + operations_tmpl='azext_terraform.custom#{}') + super().__init__(cli_ctx=cli_ctx, + custom_command_type=custom_command_type) + + def load_command_table(self, args): + from azext_terraform.commands import load_command_table + from azure.cli.core.aaz import load_aaz_command_table + try: + from . import aaz + except ImportError: + aaz = None + if aaz: + load_aaz_command_table( + loader=self, + aaz_pkg_name=aaz.__name__, + args=args + ) + load_command_table(self, args) + return self.command_table + + def load_arguments(self, command): + from azext_terraform._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = TerraformCommandsLoader diff --git a/src/terraform/azext_terraform/_help.py b/src/terraform/azext_terraform/_help.py new file mode 100644 index 00000000000..126d5d00714 --- /dev/null +++ b/src/terraform/azext_terraform/_help.py @@ -0,0 +1,11 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long +# pylint: disable=too-many-lines + +from knack.help_files import helps # pylint: disable=unused-import diff --git a/src/terraform/azext_terraform/_params.py b/src/terraform/azext_terraform/_params.py new file mode 100644 index 00000000000..cfcec717c9c --- /dev/null +++ b/src/terraform/azext_terraform/_params.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + + +def load_arguments(self, _): # pylint: disable=unused-argument + pass diff --git a/src/terraform/azext_terraform/aaz/__init__.py b/src/terraform/azext_terraform/aaz/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/terraform/azext_terraform/aaz/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/terraform/azext_terraform/aaz/latest/__init__.py b/src/terraform/azext_terraform/aaz/latest/__init__.py new file mode 100644 index 00000000000..f6acc11aa4e --- /dev/null +++ b/src/terraform/azext_terraform/aaz/latest/__init__.py @@ -0,0 +1,10 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + diff --git a/src/terraform/azext_terraform/aaz/latest/terraform/__cmd_group.py b/src/terraform/azext_terraform/aaz/latest/terraform/__cmd_group.py new file mode 100644 index 00000000000..2cbc254e686 --- /dev/null +++ b/src/terraform/azext_terraform/aaz/latest/terraform/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "terraform", + is_preview=True, +) +class __CMDGroup(AAZCommandGroup): + """Azure Terraform experience + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/terraform/azext_terraform/aaz/latest/terraform/__init__.py b/src/terraform/azext_terraform/aaz/latest/terraform/__init__.py new file mode 100644 index 00000000000..6db72297c11 --- /dev/null +++ b/src/terraform/azext_terraform/aaz/latest/terraform/__init__.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._export_terraform import * diff --git a/src/terraform/azext_terraform/aaz/latest/terraform/_export_terraform.py b/src/terraform/azext_terraform/aaz/latest/terraform/_export_terraform.py new file mode 100644 index 00000000000..c0189b51908 --- /dev/null +++ b/src/terraform/azext_terraform/aaz/latest/terraform/_export_terraform.py @@ -0,0 +1,388 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "terraform export-terraform", + is_preview=True, +) +class ExportTerraform(AAZCommand): + """Exports the Terraform configuration of the specified resource(s) + + :example: Export a resource group targeting to `azurerm` provider + az terraform export-terraform --export-resource-group '{resource-group-name:my-rg}' + + :example: 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]}' + + :example: 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}" + """ + + _aaz_info = { + "version": "2023-07-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.azureterraform/exportterraform", "2023-07-01-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + # define Arg Group "ExportParameter" + + _args_schema = cls._args_schema + _args_schema.export_query = AAZObjectArg( + options=["--export-query"], + arg_group="ExportParameter", + help="Export parameter for resources queried by ARG (Azure Resource Graph).", + ) + _args_schema.export_resource = AAZObjectArg( + options=["--export-resource"], + arg_group="ExportParameter", + help="Export parameter for individual resources.", + ) + _args_schema.export_resource_group = AAZObjectArg( + options=["--export-resource-group"], + arg_group="ExportParameter", + help="Export parameter for a resource group.", + ) + _args_schema.full_properties = AAZBoolArg( + options=["--full-properties"], + arg_group="ExportParameter", + help="Whether to output all non-computed properties in the generated Terraform configuration? This probably needs manual modifications to make it valid", + default=True, + ) + _args_schema.mask_sensitive = AAZBoolArg( + options=["--mask-sensitive"], + arg_group="ExportParameter", + help="Mask sensitive attributes in the Terraform configuration", + default=True, + ) + _args_schema.target_provider = AAZStrArg( + options=["--target-provider"], + arg_group="ExportParameter", + help="The target Azure Terraform Provider", + default="azurerm", + enum={"azapi": "azapi", "azurerm": "azurerm"}, + ) + + export_query = cls._args_schema.export_query + export_query.name_pattern = AAZStrArg( + options=["name-pattern"], + help="The name pattern of the Terraform resources", + default="res-", + ) + export_query.query = AAZStrArg( + options=["query"], + help="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\"`", + required=True, + ) + export_query.recursive = AAZBoolArg( + options=["recursive"], + help="Whether to recursively list child resources of the query result", + default=False, + ) + + export_resource = cls._args_schema.export_resource + export_resource.name_pattern = AAZStrArg( + options=["name-pattern"], + help="The name pattern of the Terraform resources", + default="res-", + ) + export_resource.resource_ids = AAZListArg( + options=["resource-ids"], + help="The id of the resource to be exported", + required=True, + ) + export_resource.resource_name = AAZStrArg( + options=["resource-name"], + help="The Terraform resource name. Only works when `resourceIds` contains only one item.", + default="res-0", + ) + export_resource.resource_type = AAZStrArg( + options=["resource-type"], + help="The Terraform resource type. Only works when `resourceIds` contains only one item.", + ) + + resource_ids = cls._args_schema.export_resource.resource_ids + resource_ids.Element = AAZStrArg() + + export_resource_group = cls._args_schema.export_resource_group + export_resource_group.name_pattern = AAZStrArg( + options=["name-pattern"], + help="The name pattern of the Terraform resources", + default="res-", + ) + export_resource_group.resource_group_name = AAZStrArg( + options=["resource-group-name"], + help="The name of the resource group to be exported", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ExportTerraform(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ExportTerraform(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.AzureTerraform/exportTerraform", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2023-07-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("fullProperties", AAZBoolType, ".full_properties") + _builder.set_prop("maskSensitive", AAZBoolType, ".mask_sensitive") + _builder.set_prop("targetProvider", AAZStrType, ".target_provider") + _builder.set_const("type", "ExportQuery", AAZStrType, ".export_query", typ_kwargs={"flags": {"required": True}}) + _builder.set_const("type", "ExportResource", AAZStrType, ".export_resource", typ_kwargs={"flags": {"required": True}}) + _builder.set_const("type", "ExportResourceGroup", AAZStrType, ".export_resource_group", typ_kwargs={"flags": {"required": True}}) + _builder.discriminate_by("type", "ExportQuery") + _builder.discriminate_by("type", "ExportResource") + _builder.discriminate_by("type", "ExportResourceGroup") + + disc_export_query = _builder.get("{type:ExportQuery}") + if disc_export_query is not None: + disc_export_query.set_prop("namePattern", AAZStrType, ".export_query.name_pattern") + disc_export_query.set_prop("query", AAZStrType, ".export_query.query", typ_kwargs={"flags": {"required": True}}) + disc_export_query.set_prop("recursive", AAZBoolType, ".export_query.recursive") + + disc_export_resource = _builder.get("{type:ExportResource}") + if disc_export_resource is not None: + disc_export_resource.set_prop("namePattern", AAZStrType, ".export_resource.name_pattern") + disc_export_resource.set_prop("resourceIds", AAZListType, ".export_resource.resource_ids", typ_kwargs={"flags": {"required": True}}) + disc_export_resource.set_prop("resourceName", AAZStrType, ".export_resource.resource_name") + disc_export_resource.set_prop("resourceType", AAZStrType, ".export_resource.resource_type") + + resource_ids = _builder.get("{type:ExportResource}.resourceIds") + if resource_ids is not None: + resource_ids.set_elements(AAZStrType, ".") + + disc_export_resource_group = _builder.get("{type:ExportResourceGroup}") + if disc_export_resource_group is not None: + disc_export_resource_group.set_prop("namePattern", AAZStrType, ".export_resource_group.name_pattern") + disc_export_resource_group.set_prop("resourceGroupName", AAZStrType, ".export_resource_group.resource_group_name", typ_kwargs={"flags": {"required": True}}) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.end_time = AAZStrType( + serialized_name="endTime", + flags={"read_only": True}, + ) + _schema_on_200_201.error = AAZObjectType() + _ExportTerraformHelper._build_schema_error_detail_read(_schema_on_200_201.error) + _schema_on_200_201.id = AAZStrType() + _schema_on_200_201.name = AAZStrType() + _schema_on_200_201.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.start_time = AAZStrType( + serialized_name="startTime", + flags={"read_only": True}, + ) + _schema_on_200_201.status = AAZStrType() + + properties = cls._schema_on_200_201.properties + properties.configuration = AAZStrType() + properties.errors = AAZListType() + properties.skipped_resources = AAZListType( + serialized_name="skippedResources", + ) + + errors = cls._schema_on_200_201.properties.errors + errors.Element = AAZObjectType() + _ExportTerraformHelper._build_schema_error_detail_read(errors.Element) + + skipped_resources = cls._schema_on_200_201.properties.skipped_resources + skipped_resources.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _ExportTerraformHelper: + """Helper class for ExportTerraform""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.info = AAZFreeFormDictType( + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + +__all__ = ["ExportTerraform"] diff --git a/src/terraform/azext_terraform/azext_metadata.json b/src/terraform/azext_terraform/azext_metadata.json new file mode 100644 index 00000000000..b1e08d1f4b1 --- /dev/null +++ b/src/terraform/azext_terraform/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isPreview": true, + "azext.minCliCoreVersion": "2.61.0" +} \ No newline at end of file diff --git a/src/terraform/azext_terraform/commands.py b/src/terraform/azext_terraform/commands.py new file mode 100644 index 00000000000..b0d842e4993 --- /dev/null +++ b/src/terraform/azext_terraform/commands.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +# from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): # pylint: disable=unused-argument + pass diff --git a/src/terraform/azext_terraform/custom.py b/src/terraform/azext_terraform/custom.py new file mode 100644 index 00000000000..86df1e48ef5 --- /dev/null +++ b/src/terraform/azext_terraform/custom.py @@ -0,0 +1,14 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from knack.log import get_logger + + +logger = get_logger(__name__) diff --git a/src/terraform/azext_terraform/tests/__init__.py b/src/terraform/azext_terraform/tests/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/terraform/azext_terraform/tests/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/terraform/azext_terraform/tests/latest/__init__.py b/src/terraform/azext_terraform/tests/latest/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/terraform/azext_terraform/tests/latest/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/terraform/azext_terraform/tests/latest/test_terraform.py b/src/terraform/azext_terraform/tests/latest/test_terraform.py new file mode 100644 index 00000000000..510bbeb8015 --- /dev/null +++ b/src/terraform/azext_terraform/tests/latest/test_terraform.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +from azure.cli.testsdk import * + + +class TerraformScenario(ScenarioTest): + # TODO: add tests here + pass diff --git a/src/terraform/setup.cfg b/src/terraform/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/terraform/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/terraform/setup.py b/src/terraform/setup.py new file mode 100644 index 00000000000..20530943c12 --- /dev/null +++ b/src/terraform/setup.py @@ -0,0 +1,49 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +from codecs import open +from setuptools import setup, find_packages + + +# HISTORY.rst entry. +VERSION = '1.0.0b1' + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [] + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='terraform', + version=VERSION, + description='Microsoft Azure Command-Line Tools Terraform Extension.', + long_description=README + '\n\n' + HISTORY, + license='MIT', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/main/src/terraform', + classifiers=CLASSIFIERS, + packages=find_packages(exclude=["tests"]), + package_data={'azext_terraform': ['azext_metadata.json']}, + install_requires=DEPENDENCIES +) From 8750c1b8275a4be3dd5141d20e82306bfd79a5de Mon Sep 17 00:00:00 2001 From: magodo Date: Wed, 25 Sep 2024 17:26:23 +0800 Subject: [PATCH 2/2] remove test folder --- src/terraform/azext_terraform/tests/__init__.py | 6 ------ .../azext_terraform/tests/latest/__init__.py | 6 ------ .../azext_terraform/tests/latest/test_terraform.py | 13 ------------- 3 files changed, 25 deletions(-) delete mode 100644 src/terraform/azext_terraform/tests/__init__.py delete mode 100644 src/terraform/azext_terraform/tests/latest/__init__.py delete mode 100644 src/terraform/azext_terraform/tests/latest/test_terraform.py diff --git a/src/terraform/azext_terraform/tests/__init__.py b/src/terraform/azext_terraform/tests/__init__.py deleted file mode 100644 index 5757aea3175..00000000000 --- a/src/terraform/azext_terraform/tests/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -# Code generated by aaz-dev-tools -# -------------------------------------------------------------------------------------------- diff --git a/src/terraform/azext_terraform/tests/latest/__init__.py b/src/terraform/azext_terraform/tests/latest/__init__.py deleted file mode 100644 index 5757aea3175..00000000000 --- a/src/terraform/azext_terraform/tests/latest/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -# Code generated by aaz-dev-tools -# -------------------------------------------------------------------------------------------- diff --git a/src/terraform/azext_terraform/tests/latest/test_terraform.py b/src/terraform/azext_terraform/tests/latest/test_terraform.py deleted file mode 100644 index 510bbeb8015..00000000000 --- a/src/terraform/azext_terraform/tests/latest/test_terraform.py +++ /dev/null @@ -1,13 +0,0 @@ -# -------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# -# Code generated by aaz-dev-tools -# -------------------------------------------------------------------------------------------- - -from azure.cli.testsdk import * - - -class TerraformScenario(ScenarioTest): - # TODO: add tests here - pass