From c92ed9357d9fb9708869bc9f34586a89d968dcf3 Mon Sep 17 00:00:00 2001 From: comprelzhang Date: Thu, 6 May 2021 15:06:19 +0800 Subject: [PATCH 01/12] =?UTF-8?q?[update]=E4=BF=AE=E5=A4=8Deip=20backend?= =?UTF-8?q?=20=E5=BC=95=E7=94=A8=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/network/eip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/network/eip.py b/apps/api/network/eip.py index 06feecc4..0fea1788 100644 --- a/apps/api/network/eip.py +++ b/apps/api/network/eip.py @@ -46,7 +46,7 @@ def __init__(self): self.resource_keys_config = None -class EipBackendApi(Common, ApiBase): +class EipBackendApi(Common, ApiBackendBase): def __init__(self): super(EipBackendApi, self).__init__() self.resource_name = "eip" From 3cd2a6ebb36301dda3fb9667a3224a0a4c844688 Mon Sep 17 00:00:00 2001 From: comprelzhang Date: Thu, 6 May 2021 16:47:13 +0800 Subject: [PATCH 02/12] =?UTF-8?q?[update]=E6=9B=B4=E6=96=B0import=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=8F=90=E7=A4=BA=EF=BC=8C=20list=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/apibase_backend.py | 3 ++- apps/common/convert_keys.py | 5 ++++- apps/controller/network/nat_controller.py | 1 + core/validation.py | 9 +++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/api/apibase_backend.py b/apps/api/apibase_backend.py index 9b2af441..a596d4c8 100644 --- a/apps/api/apibase_backend.py +++ b/apps/api/apibase_backend.py @@ -328,7 +328,8 @@ def source_run_import(self, rid, provider, region, label_name, # if workpath: # self.rollback_workspace(workpath) logger.info(traceback.format_exc()) - logger.info("resource import failed. continue ... ") + # logger.info("resource import failed. continue ... ") + raise e logger.info("state file not recovery, continue apply resource ... ") return True diff --git a/apps/common/convert_keys.py b/apps/common/convert_keys.py index 01a3942c..b803e388 100644 --- a/apps/common/convert_keys.py +++ b/apps/common/convert_keys.py @@ -62,7 +62,10 @@ def validate_type(value, type): try: if isinstance(value, basestring): if value.startswith("["): - value = json.loads(value) + try: + value = json.loads(value) + except: + value = eval(value) elif "," in value: value = value.split(",") elif ";" in value: diff --git a/apps/controller/network/nat_controller.py b/apps/controller/network/nat_controller.py index 12dd1564..57ee6fa5 100644 --- a/apps/controller/network/nat_controller.py +++ b/apps/controller/network/nat_controller.py @@ -43,6 +43,7 @@ def create(cls, resource, data, **kwargs): vpc_id = data.pop("vpc_id", None) subnet_id = data.pop("subnet_id", None) eip = data.pop("eip", None) + # eip = validation.validate_list("eip", data.pop("eip", None)) asset_id = data.pop("asset_id", None) resource_id = data.pop("resource_id", None) diff --git a/core/validation.py b/core/validation.py index fe6fd37f..567fba8b 100644 --- a/core/validation.py +++ b/core/validation.py @@ -135,6 +135,15 @@ def validate_collector(data, strings=None, dicts=None, lists=None, ints=None, po def validate_list(key, value, minlen=None, maxlen=None): if not value: return [] + if isinstance(value, basestring): + value = value.strip() + if value.startswith("[") and value.endswith("]"): + try: + value = json.loads(value) + except: + value = eval(value) + elif "," in value and "[" not in value: + value = value.split(",") if not isinstance(value, list): raise ValueError("%s 不是合法类型list" % key) if minlen and len(value) < minlen: From a01ad9566deb397aaf6efe03fee93ed9469c06dd Mon Sep 17 00:00:00 2001 From: comprelzhang Date: Thu, 6 May 2021 17:12:00 +0800 Subject: [PATCH 03/12] =?UTF-8?q?[update]=20=E6=96=B0=E5=A2=9Enat=E6=94=AF?= =?UTF-8?q?=E6=8C=81bandwith?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/controller/configer/defines.py | 4 ++-- apps/controller/configer/model_args.py | 6 ++++-- apps/controller/network/nat_controller.py | 5 ++++- register.xml | 2 ++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/apps/controller/configer/defines.py b/apps/controller/configer/defines.py index 48ea4577..12046a85 100644 --- a/apps/controller/configer/defines.py +++ b/apps/controller/configer/defines.py @@ -226,7 +226,7 @@ "method": "POST", "notnull": ['name', 'provider', 'vpc_id', 'region'], "inputParameters": ['id', 'name', 'secret', 'provider', 'vpc_id', 'subnet_id', 'eip', 'zone', 'region', - 'asset_id', 'resource_id', 'extend_info'], + 'asset_id', 'resource_id', 'extend_info', 'bandwidth'], "outputParameters": ['errorMessage', 'errorCode', 'ipaddress', 'id', 'resource_id'] }, "destroy": { @@ -242,7 +242,7 @@ "notnull": ["region", "provider"], "inputParameters": ['region', 'secret', 'provider', 'resource_id', 'name', 'type', 'tag', 'vpc_id'], "outputParameters": ['region', 'secret', 'provider', 'resource_id', 'errorMessage', 'errorCode', 'name', - 'vpc_id', 'eip', 'ipaddress'] + 'vpc_id', 'eip', 'ipaddress', 'bandwidth'] } }, "eip": { diff --git a/apps/controller/configer/model_args.py b/apps/controller/configer/model_args.py index f57b595b..36e172b6 100644 --- a/apps/controller/configer/model_args.py +++ b/apps/controller/configer/model_args.py @@ -46,7 +46,8 @@ "name", "vpc_id", "subnet_id", - "eip" + "eip", + "bandwidth" ], "peer_connection": [ "name", @@ -516,7 +517,8 @@ "name", "type", "tag", - "vpc_id" + "vpc_id", + "bandwidth" ], "peer_connection": [ "resource_id", diff --git a/apps/controller/network/nat_controller.py b/apps/controller/network/nat_controller.py index 57ee6fa5..fa6b86c8 100644 --- a/apps/controller/network/nat_controller.py +++ b/apps/controller/network/nat_controller.py @@ -47,11 +47,14 @@ def create(cls, resource, data, **kwargs): asset_id = data.pop("asset_id", None) resource_id = data.pop("resource_id", None) + bandwidth = data.pop("bandwidth", None) extend_info = validation.validate_dict("extend_info", data.pop("extend_info", None)) data.update(extend_info) - create_data = {"name": name, "vpc_id": vpc_id, "subnet_id": subnet_id, "eip": eip} + create_data = {"name": name, "vpc_id": vpc_id, + "subnet_id": subnet_id, "eip": eip, + "bandwidth": bandwidth} _, result = resource.create(rid=rid, provider=provider, region=region, zone=zone, secret=secret, diff --git a/register.xml b/register.xml index ef4be351..e39051ad 100644 --- a/register.xml +++ b/register.xml @@ -539,6 +539,7 @@ zone region asset_id + bandwidth resource_id extend_info @@ -580,6 +581,7 @@ errorCode name vpc_id + bandwidth eip ipaddress From b2dc85588afa5ba1fbbdb867690c6c3cf58f985e Mon Sep 17 00:00:00 2001 From: comprelzhang Date: Fri, 7 May 2021 15:27:01 +0800 Subject: [PATCH 04/12] =?UTF-8?q?[update]=E8=B5=84=E6=BA=90=E5=9B=9E?= =?UTF-8?q?=E5=88=B7=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE=EF=BC=8C=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/apibase_backend.py | 38 +++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/apps/api/apibase_backend.py b/apps/api/apibase_backend.py index a596d4c8..bc533784 100644 --- a/apps/api/apibase_backend.py +++ b/apps/api/apibase_backend.py @@ -44,6 +44,30 @@ def fetech_property(instance_define, define_columns): return res +def fetch_columns(datas, columns): + if len(columns) == 0: + c_data = [] + for data in datas: + if isinstance(data, list): + c_data += data + else: + c_data.append(data) + return c_data + column = columns.pop(0) + if isinstance(datas, list): + x_data = [] + for data in datas: + x_data.append(data.get(column)) + datas = x_data + return fetch_columns(datas, columns) + elif isinstance(datas, dict): + datas = datas.get(column) + return fetch_columns(datas, columns) + else: + logger.info("data is not dict/list, no columns %s filter, skip.." % column) + return datas + + class ApiBackendBase(TerraformResource): def __init__(self): super(ApiBackendBase, self).__init__() @@ -557,17 +581,19 @@ def read_query_result_controller(self, provider, result, data_source_argument): logger.info(format_json_dumps(result)) try: + instance_define = [] _data = result.get("resources")[0] _instances = _data.get("instances")[0] _attributes = _instances.get("attributes") outlines = data_source_argument.split(".") - for outline in outlines: - if outline: - _attributes = _attributes.get(outline) - - instance_list = _attributes - instance_define = instance_list + # for outline in outlines: + # if outline: + # _attributes = _attributes.get(outline) + # + # instance_list = _attributes + # instance_define = instance_list + instance_define = fetch_columns(datas=_attributes, columns=outlines) except: logger.info(traceback.format_exc()) raise ValueError("query remote source failed, result read faild") From 79f076261df553f1e375d469e4592032d5195c7b Mon Sep 17 00:00:00 2001 From: comprelzhang Date: Fri, 7 May 2021 15:27:46 +0800 Subject: [PATCH 05/12] =?UTF-8?q?[update]=E6=9B=B4=E6=96=B0allow=20null=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81str=20int?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/convert_keys.py | 9 ++++++++- apps/controller/configer/provider_controller.py | 4 ++-- apps/controller/configer/resource_controller.py | 7 ++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/apps/common/convert_keys.py b/apps/common/convert_keys.py index b803e388..a589bc20 100644 --- a/apps/common/convert_keys.py +++ b/apps/common/convert_keys.py @@ -8,6 +8,7 @@ def validate_convert_key(defines): + x_res = {} for key, define in defines.items(): if (not isinstance(define, (basestring, dict))) or isinstance(define, list): raise ValueError("错误的定义 合法值为 string " @@ -18,8 +19,14 @@ def validate_convert_key(defines): if isinstance(define, dict): if define.get("type", "string") not in ["string", "json", "int", "float", "list", "bool"]: raise ValueError("未知的类型约束 %s" % define.get("type")) - if define.get("allow_null", 1) not in [0, 1]: + if define.get("allow_null", 1) not in [0, 1, '0', '1']: raise ValueError("allow_null 合法值为 0/1") + else: + define["allow_null"] = int(define.get("allow_null", 1)) + + x_res[key] = define + + return x_res def validate_convert_value(defines): diff --git a/apps/controller/configer/provider_controller.py b/apps/controller/configer/provider_controller.py index 5cf3d919..ac5ae742 100644 --- a/apps/controller/configer/provider_controller.py +++ b/apps/controller/configer/provider_controller.py @@ -66,7 +66,7 @@ def create(self, request, data, **kwargs): name = data.get("name") extend_info = validation.validate_dict("extend_info", data.get("extend_info")) or {} provider_property = validation.validate_dict("provider_property", data.get("provider_property")) or {} - validate_convert_key(provider_property) + provider_property = validate_convert_key(provider_property) validate_convert_value(extend_info) property_necessary(resource_name="provider", resource_property=provider_property) @@ -115,7 +115,7 @@ def update(self, request, data, **kwargs): if data.get("provider_property") is not None: provider_property = validation.validate_dict("provider_property", data.get("provider_property")) or {} - validate_convert_key(provider_property) + provider_property = validate_convert_key(provider_property) property_necessary(resource_name="provider", resource_property=provider_property) data["provider_property"] = json.dumps(provider_property) diff --git a/apps/controller/configer/resource_controller.py b/apps/controller/configer/resource_controller.py index 0646d9f4..bbb3d877 100644 --- a/apps/controller/configer/resource_controller.py +++ b/apps/controller/configer/resource_controller.py @@ -87,10 +87,10 @@ def create(self, request, data, **kwargs): # if not isinstance(value, basestring): # raise ValueError("data_source_output 为key-value定义") - validate_convert_key(resource_property) + resource_property = validate_convert_key(resource_property) validate_convert_value(extend_info) validate_convert_value(resource_output) - validate_convert_key(data_source_output) + data_source_output = validate_convert_key(data_source_output) property_necessary(resource_name=data["resource_name"], resource_property=resource_property) @@ -158,7 +158,7 @@ def update(self, request, data, **kwargs): if data.get("resource_property") is not None: resource_property = validation.validate_dict("resource_property", data.get("resource_property")) or {} - validate_convert_key(resource_property) + resource_property = validate_convert_key(resource_property) property_necessary(resource_name=data["resource_name"], resource_property=resource_property) @@ -181,6 +181,7 @@ def update(self, request, data, **kwargs): if data.get("data_source_output") is not None: data_source_output = validation.validate_dict("data_source_output", data.get("data_source_output")) + data_source_output = validate_convert_key(data_source_output) property_necessary(resource_name=data["resource_name"], resource_property=data_source_output) From f105ed83d65b5e68a819c65a7272cfbf5ef442b7 Mon Sep 17 00:00:00 2001 From: comprelzhang Date: Fri, 7 May 2021 15:28:45 +0800 Subject: [PATCH 06/12] =?UTF-8?q?[update]=20disk=E6=B7=BB=E5=8A=A0zone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/controller/configer/defines.py | 3 ++- apps/controller/configer/model_args.py | 3 ++- register.xml | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/controller/configer/defines.py b/apps/controller/configer/defines.py index 12046a85..8658a55d 100644 --- a/apps/controller/configer/defines.py +++ b/apps/controller/configer/defines.py @@ -365,7 +365,8 @@ "path": "/terraform/v1/storage/backend/disk/source", "method": "POST", "notnull": ["region", "provider"], - "inputParameters": ['region', 'secret', 'provider', 'resource_id', 'name', 'instance_id', 'type', 'tag'], + "inputParameters": ['region', 'secret', 'provider', 'resource_id', + 'name', 'instance_id', 'type', 'tag', 'zone'], "outputParameters": ['region', 'secret', 'provider', 'resource_id', 'errorMessage', 'errorCode', 'name', 'type', 'size', 'zone', "charge_type"] } diff --git a/apps/controller/configer/model_args.py b/apps/controller/configer/model_args.py index 36e172b6..670d6ebe 100644 --- a/apps/controller/configer/model_args.py +++ b/apps/controller/configer/model_args.py @@ -560,7 +560,8 @@ "name", "instance_id", "type", - "tag" + "tag", + "zone" ], "disk_attach": [ "resource_id", diff --git a/register.xml b/register.xml index e39051ad..cc6bf213 100644 --- a/register.xml +++ b/register.xml @@ -838,6 +838,7 @@ instance_id type tag + zone region From d409043fe62ca67d089839733e73bf88333f717a Mon Sep 17 00:00:00 2001 From: comprelzhang Date: Fri, 7 May 2021 16:20:09 +0800 Subject: [PATCH 07/12] =?UTF-8?q?[update]=E6=9B=B4=E6=96=B0resource?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/update.sql | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/update.sql b/doc/update.sql index 4b6fcda8..c2e57c19 100644 --- a/doc/update.sql +++ b/doc/update.sql @@ -45,8 +45,8 @@ UPDATE terraform.resource SET provider='tencentcloud', resource_type='eip_assoc UPDATE terraform.resource SET provider='tencentcloud', resource_type='route_table', resource_name='tencentcloud_route_table', extend_info='{}', resource_property='{"vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "name": {"convert": "name", "allow_null": 0, "type": "string"}}', resource_output='{"resource_id": "id"}', data_source_name='tencentcloud_vpc_route_tables', data_source_argument='instance_list', data_source='{"vpc_id": "vpc_id", "tag": "tags", "name": "name", "resource_id": "route_table_id"}', data_source_output='{"vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "name": {"convert": "name", "allow_null": 0, "type": "string"}, "resource_id": "route_table_id"}' WHERE id='1276c410c524401c9e37c5cab2add904'; UPDATE terraform.resource SET provider='tencentcloud', resource_type='security_group', resource_name='tencentcloud_security_group', extend_info='{"description": "from terraform", "tags": {"type": "json"}}', resource_property='{"vpc_id": "-", "name": {"convert": "name", "allow_null": 0, "type": "string"}}', resource_output='{}', data_source_name='tencentcloud_security_groups', data_source_argument='security_groups', data_source='{"vpc_id": "-", "tag": "tags", "name": "name", "resource_id": "security_group_id"}', data_source_output='{"vpc_id": "-", "name": {"convert": "name", "allow_null": 0, "type": "string"}, "resource_id": "security_group_id"}' WHERE id='161ba756498c4514893d7b37c83d3daf'; UPDATE terraform.resource SET provider='alicloud', resource_type='vpc', resource_name='alicloud_vpc', extend_info='{"description": "from terraform", "tags": {"type": "json"}}', resource_property='{"cidr": {"convert": "cidr_block", "allow_null": 0, "type": "string"}, "name": {"convert": "name", "allow_null": 0, "type": "string"}}', resource_output='{"resource_id": "id"}', data_source_name='alicloud_vpcs', data_source_argument='vpcs', data_source='{"cidr": "cidr_block", "tag": {"convert": "tags", "type": "json"}, "name": "vpc_name", "resource_id": {"convert": "ids", "type": "list"}}', data_source_output='{"cidr": {"convert": "cidr_block", "allow_null": 0, "type": "string"}, "name": "vpc_name", "resource_id": "id"}' WHERE id='1c9a8a30d3da48d38941509e6149d61e'; -UPDATE terraform.resource SET provider='tencentcloud', resource_type='route_entry', resource_name='tencentcloud_route_table_entry', extend_info='{"description": "from terraform"}', resource_property='{"next_hub": {"convert": "next_hub", "allow_null": 0, "type": "string"}, "name": "-", "destination": {"convert": "destination_cidr_block", "allow_null": 0, "type": "string"}, "next_type": {"convert": "next_type", "allow_null": 0, "type": "string"}, "route_table_id": {"convert": "route_table_id", "allow_null": 0, "type": "string"}, "vpc_id": "-"}', resource_output='{"resource_id": "id"}', data_source_name='tencentcloud_vpc_route_tables', data_source_argument='instance_list', data_source='{"route_table_id": "route_table_id", "cidr": "-", "type": "-", "resource_id": "route_table_id"}', data_source_output='{"next_hub": {"convert": "next_hub", "allow_null": 0, "type": "string"}, "name": "-", "resource_id": "route_entry_id", "destination": {"convert": "destination_cidr_block", "allow_null": 0, "type": "string"}, "next_type": {"convert": "next_type", "allow_null": 0, "type": "string"}, "route_table_id": {"convert": "route_table_id", "allow_null": 0, "type": "string"}}' WHERE id='2440b0e9abaf4ebca78461b1b64324ca'; -UPDATE terraform.resource SET provider='tencentcloud', resource_type='eip', resource_name='tencentcloud_eip', extend_info='{}', resource_property='{"charge_type": "internet_charge_type", "name": {"convert": "name", "allow_null": 0, "type": "string"}}', resource_output='{"ipaddress": "public_ip", "resource_id": "id"}', data_source_name='tencentcloud_eips', data_source_argument='eip_list', data_source='{"tag": "tags", "ipaddress": "public_ip", "name": "eip_name", "resource_id": "eip_id"}', data_source_output='{"name": {"convert": "name", "allow_null": 0, "type": "string"}, "resource_id": "eip_id"}' WHERE id='248cfc042c2d4e3c93e43fceff06016f'; +UPDATE terraform.resource SET provider='tencentcloud', resource_type='route_entry', resource_name='tencentcloud_route_table_entry', extend_info='{"description": "from terraform"}', resource_property='{"next_hub": {"convert": "next_hub", "allow_null": 0, "type": "string"}, "name": "-", "destination": {"convert": "destination_cidr_block", "allow_null": 0, "type": "string"}, "next_type": {"convert": "next_type", "allow_null": 0, "type": "string"}, "route_table_id": {"convert": "route_table_id", "allow_null": 0, "type": "string"}, "vpc_id": "-"}', resource_output='{"resource_id": "id"}', data_source_name='tencentcloud_vpc_route_tables', data_source_argument='instance_list.route_entry_infos', data_source='{"route_table_id": "route_table_id", "cidr": "-", "type": "-", "resource_id": "route_table_id"}', data_source_output='{"next_hub": {"convert": "next_hub", "allow_null": 0, "type": "string"}, "name": "-", "resource_id": "route_entry_id", "destination": {"convert": "destination_cidr_block", "allow_null": 0, "type": "string"}, "next_type": {"convert": "next_type", "allow_null": 0, "type": "string"}, "route_table_id": {"convert": "route_table_id", "allow_null": 0, "type": "string"}}' WHERE id='2440b0e9abaf4ebca78461b1b64324ca'; +UPDATE terraform.resource SET provider='tencentcloud', resource_type='eip', resource_name='tencentcloud_eip', extend_info='{}', resource_property='{"charge_type": "internet_charge_type", "name": {"convert": "name", "allow_null": 0, "type": "string"}}', resource_output='{"ipaddress": "public_ip", "resource_id": "id"}', data_source_name='tencentcloud_eips', data_source_argument='eip_list', data_source='{"tag": "tags", "ipaddress": "public_ip", "name": "eip_name", "resource_id": "eip_id"}', data_source_output='{"ipaddress": "public_ip", "name": {"convert": "eip_name", "allow_null": 0, "type": "string"}, "resource_id": "eip_id"}' WHERE id='248cfc042c2d4e3c93e43fceff06016f'; UPDATE terraform.resource SET provider='alicloud', resource_type='route_entry', resource_name='alicloud_route_entry', extend_info='{}', resource_property='{"next_hub": {"convert": "nexthop_id", "allow_null": 0, "type": "string"}, "name": "name", "destination": {"convert": "destination_cidrblock", "allow_null": 0, "type": "string"}, "next_type": {"convert": "nexthop_type", "allow_null": 0, "type": "string"}, "route_table_id": {"convert": "route_table_id", "allow_null": 0, "type": "string"}, "vpc_id": "-"}', resource_output='{"resource_id": "id"}', data_source_name='alicloud_route_entry', data_source_argument='entries', data_source='{"route_table_id": "route_table_id", "cidr": "cidr_block", "type": "type", "resource_id": "route_table_id"}', data_source_output='{"next_hub": {"convert": "nexthop_id", "allow_null": 0, "type": "string"}, "name": "name", "destination": {"convert": "cidr_block", "allow_null": 0, "type": "string"}, "next_type": {"convert": "next_hop_type", "allow_null": 0, "type": "string"}, "route_table_id": {"convert": "route_table_id", "allow_null": 0, "type": "string"}, "vpc_id": "-"}' WHERE id='27d7a534b0274355a3223faf8c3243f7'; UPDATE terraform.resource SET provider='tencentcloud', resource_type='security_group_rule', resource_name='tencentcloud_security_group_rule', extend_info='{"description": "from terraform"}', resource_property='{"cidr_ip": {"convert": "cidr_ip", "allow_null": 0, "type": "string"}, "ip_protocol": {"convert": "ip_protocol", "allow_null": 0, "type": "string"}, "security_group_id": {"convert": "security_group_id", "allow_null": 0, "type": "string"}, "policy": {"convert": "policy", "allow_null": 0, "type": "string"}, "vpc_id": "-", "type": {"convert": "type", "allow_null": 0, "type": "string"}, "ports": {"convert": "port_range", "allow_null": 0, "type": "string"}, "description": {"convert": "description", "allow_null": 1, "type": "string"}}', resource_output='{}', data_source_name='', data_source_argument='', data_source='{}', data_source_output='{}' WHERE id='2aa8cd54f561493a981eae5fbcd0661f'; UPDATE terraform.resource SET provider='alicloud', resource_type='disk_attach', resource_name='alicloud_disk_attachment', extend_info='{}', resource_property='{"instance_id": {"convert": "instance_id", "allow_null": 0, "type": "string"}, "disk_id": {"convert": "disk_id", "allow_null": 0, "type": "string"}}', resource_output='{"resource_id": "id"}', data_source_name='', data_source_argument='', data_source='{}', data_source_output='{}' WHERE id='2b7a75d4c4c64a6698ceb17859008047'; @@ -58,7 +58,7 @@ UPDATE terraform.resource SET provider='tencentcloud', resource_type='ccn', res UPDATE terraform.resource SET provider='alicloud', resource_type='mysql_account', resource_name='alicloud_db_account', extend_info='{"description": "from terraform"}', resource_property='{"mysql_id": {"convert": "instance_id", "allow_null": 0, "type": "string"}, "password": {"convert": "password", "allow_null": 0, "type": "string"}, "name": {"convert": "name", "allow_null": 0, "type": "string"}}', resource_output='{"resource_id": "id"}', data_source_name='', data_source_argument='', data_source='{}', data_source_output='{}' WHERE id='5f55e449191b4a19830ab2e8f11a19d7'; UPDATE terraform.resource SET provider='tencentcloud', resource_type='disk_attach', resource_name='tencentcloud_cbs_storage_attachment', extend_info='{}', resource_property='{"instance_id": {"convert": "instance_id", "allow_null": 0, "type": "string"}, "disk_id": {"convert": "storage_id", "allow_null": 0, "type": "string"}}', resource_output='{"resource_id": "id"}', data_source_name='', data_source_argument='', data_source='{}', data_source_output='{}' WHERE id='65eab698bf954edea256fb04127a5ff4'; UPDATE terraform.resource SET provider='tencentcloud', resource_type='ccn_bandwidth', resource_name='tencentcloud_ccn_bandwidth_limit', extend_info='{}', resource_property='{"dest_region": {"convert": "dst_region", "allow_null": 1, "type": "string"}, "bandwidth": {"convert": "bandwidth_limit", "allow_null": 1, "type": "string"}, "from_region": {"convert": "region", "allow_null": 1, "type": "string"}, "ccn_id": {"convert": "ccn_id", "allow_null": 0, "type": "string"}}', resource_output='{"resource_id": "id"}', data_source_name='', data_source_argument='', data_source='{}', data_source_output='{}' WHERE id='66ef0458af3c4576a933cfee085acc9f'; -UPDATE terraform.resource SET provider='tencentcloud', resource_type='mysql', resource_name='tencentcloud_mysql_instance', extend_info='{"slave_deploy_mode": 0, "internet_service": 0}', resource_property='{"engine": "-", "charge_type": "charge_type", "disk_type": "-", "disk_size": {"convert": "volume_size", "allow_null": 0, "type": "int"}, "name": {"convert": "instance_name", "allow_null": 0, "type": "string"}, "zone": {"convert": "availability_zone", "allow_null": 1, "type": "string"}, "subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "force_delete": {"convert": "force_delete", "allow_null": 1, "type": "bool"}, "security_group_id": {"convert": "security_groups", "allow_null": 1, "type": "list"}, "instance_type": {"default": 256, "convert": "mem_size", "allow_null": 0, "type": "int"}, "version": {"convert": "engine_version", "allow_null": 0, "type": "string"}, "user": "-", "second_slave_zone": {"convert": "second_slave_zone", "allow_null": 1, "type": "string"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "password": {"convert": "root_password", "allow_null": 1, "type": "string"}, "port": {"default": 3306, "convert": "intranet_port", "allow_null": 1, "type": "int"}, "first_slave_zone": {"convert": "first_slave_zone", "allow_null": 1, "type": "string"}}', resource_output='{"ipaddress": "intranet_ip", "port": "internet_port", "resource_id": "id"}', data_source_name='tencentcloud_mysql_instance', data_source_argument='instance_list', data_source='{"engine": "-", "name": "instance_name", "resource_id": "mysql_id", "subnet_id": "-", "tag": "-", "version": "engine_version", "vpc_id": "-", "ipaddress": "-", "port": "-"}', data_source_output='{"engine": "-", "charge_type": "charge_type", "disk_type": "-", "disk_size": {"convert": "volume_size", "allow_null": 0, "type": "int"}, "name": {"convert": "instance_name", "allow_null": 0, "type": "string"}, "zone": {"convert": "availability_zone", "allow_null": 1, "type": "string"}, "resource_id": "mysql_id", "subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "force_delete": {"convert": "force_delete", "allow_null": 1, "type": "bool"}, "security_group_id": {"convert": "security_groups", "allow_null": 1, "type": "list"}, "instance_type": {"default": 256, "convert": "mem_size", "allow_null": 0, "type": "int"}, "version": {"convert": "engine_version", "allow_null": 0, "type": "string"}, "user": "-", "second_slave_zone": {"convert": "second_slave_zone", "allow_null": 1, "type": "string"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "password": {"convert": "root_password", "allow_null": 1, "type": "string"}, "ipaddress": "intranet_ip", "port": {"default": 3306, "convert": "intranet_port", "allow_null": 1, "type": "int"}, "first_slave_zone": {"convert": "first_slave_zone", "allow_null": 1, "type": "string"}}' WHERE id='68b7aceac57640b384383262b010ac1c'; +UPDATE terraform.resource SET provider='tencentcloud', resource_type='mysql', resource_name='tencentcloud_mysql_instance', extend_info='{"slave_deploy_mode": 0, "internet_service": 0}', resource_property='{"engine": "-", "charge_type": "charge_type", "disk_type": "-", "disk_size": {"convert": "volume_size", "allow_null": 0, "type": "int"}, "name": {"convert": "instance_name", "allow_null": 0, "type": "string"}, "zone": {"convert": "availability_zone", "allow_null": 1, "type": "string"}, "subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "force_delete": {"convert": "force_delete", "allow_null": 1, "type": "bool"}, "security_group_id": {"convert": "security_groups", "allow_null": 1, "type": "list"}, "instance_type": {"default": 256, "convert": "mem_size", "allow_null": 0, "type": "int"}, "version": {"convert": "engine_version", "allow_null": 0, "type": "string"}, "user": "-", "second_slave_zone": {"convert": "second_slave_zone", "allow_null": 1, "type": "string"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "password": {"convert": "root_password", "allow_null": 1, "type": "string"}, "port": {"default": 3306, "convert": "intranet_port", "allow_null": 1, "type": "int"}, "first_slave_zone": {"convert": "first_slave_zone", "allow_null": 1, "type": "string"}}', resource_output='{"ipaddress": "intranet_ip", "port": "internet_port", "resource_id": "id"}', data_source_name='tencentcloud_mysql_instance', data_source_argument='instance_list', data_source='{"engine": "-", "name": "instance_name", "resource_id": "mysql_id", "subnet_id": "-", "tag": "-", "version": "engine_version", "vpc_id": "-", "ipaddress": "-", "port": "-"}', data_source_output='{"engine": "-", "charge_type": "charge_type", "disk_type": "-", "disk_size": {"convert": "volume_size", "allow_null": 0, "type": "int"}, "name": {"convert": "instance_name", "allow_null": 0, "type": "string"}, "zone": {"convert": "availability_zone", "allow_null": 1, "type": "string"}, "resource_id": "mysql_id", "subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "force_delete": {"convert": "force_delete", "allow_null": 1, "type": "bool"}, "security_group_id": {"convert": "security_groups", "allow_null": 1, "type": "list"}, "instance_type": {"default": 256, "convert": "memory_size", "allow_null": 0, "type": "string"}, "version": {"convert": "engine_version", "allow_null": 0, "type": "string"}, "user": "-", "second_slave_zone": {"convert": "second_slave_zone", "allow_null": 1, "type": "string"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "password": {"convert": "root_password", "allow_null": 1, "type": "string"}, "ipaddress": "intranet_ip", "port": {"default": 3306, "convert": "intranet_port", "allow_null": 1, "type": "int"}, "first_slave_zone": {"convert": "first_slave_zone", "allow_null": 1, "type": "string"}}' WHERE id='68b7aceac57640b384383262b010ac1c'; UPDATE terraform.resource SET provider='alicloud', resource_type='subnet', resource_name='alicloud_vswitch', extend_info='{"tags": {"type": "json"}}', resource_property='{"vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "cidr": {"convert": "cidr_block", "allow_null": 0, "type": "string"}, "name": {"convert": "name", "allow_null": 1, "type": "string"}, "zone": {"convert": "availability_zone", "allow_null": 0, "type": "string"}}', resource_output='{"resource_id": "id"}', data_source_name='alicloud_vswitches', data_source_argument='vswitches', data_source='{"vpc_id": "vpc_id", "tag": {"convert": "tags", "type": "json"}, "zone": "zone_id", "resource_id": {"convert": "ids", "type": "list"}}', data_source_output='{"vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "cidr": {"convert": "cidr_block", "allow_null": 0, "type": "string"}, "name": {"convert": "name", "allow_null": 1, "type": "string"}, "zone": "zone_id", "resource_id": "id"}' WHERE id='6c33d867e13141809e6449f600359c6f'; UPDATE terraform.resource SET provider='alicloud', resource_type='disk', resource_name='alicloud_disk', extend_info='{"encrypted": {"type": "bool", "value": false}, "description": "from terraform"}', resource_property='{"charge_type": "-", "type": {"default": "cloud_efficiency", "convert": "category", "allow_null": 1, "type": "string"}, "name": {"convert": "name", "allow_null": 0, "type": "string"}, "zone": {"convert": "availability_zone", "allow_null": 1, "type": "string"}, "size": {"convert": "size", "allow_null": 1, "type": "int"}}', resource_output='{"resource_id": "id"}', data_source_name='alicloud_disks', data_source_argument='disks', data_source='{"instance_id": "instance_id", "tag": {"convert": "tags", "type": "json"}, "type": "type", "name": "name_regex", "resource_id": {"convert": "ids", "type": "list"}}', data_source_output='{"resource_id": "id", "type": {"default": "cloud_efficiency", "convert": "category", "allow_null": 1, "type": "string"}, "name": {"convert": "name", "allow_null": 0, "type": "string"}, "zone": {"convert": "availability_zone", "allow_null": 1, "type": "string"}, "size": {"convert": "size", "allow_null": 1, "type": "int"}}' WHERE id='6c8d8a72c6fc4855911aa0f386195ed0'; UPDATE terraform.resource SET provider='alicloud', resource_type='security_group_rule', resource_name='alicloud_security_group_rule', extend_info='{"description": "from terraform"}', resource_property='{"nic_type": {"convert": "nic_type", "allow_null": 1, "type": "string"}, "cidr_ip": {"convert": "cidr_ip", "allow_null": 0, "type": "string"}, "ip_protocol": {"convert": "ip_protocol", "allow_null": 0, "type": "string"}, "security_group_id": {"convert": "security_group_id", "allow_null": 0, "type": "string"}, "priority": {"convert": "priority", "allow_null": 1, "type": "string"}, "policy": {"convert": "policy", "allow_null": 0, "type": "string"}, "vpc_id": "-", "type": {"convert": "type", "allow_null": 0, "type": "string"}, "ports": {"convert": "port_range", "allow_null": 0, "type": "string"}, "description": {"convert": "description", "allow_null": 1, "type": "string"}}', resource_output='{"resource_id": "id"}', data_source_name='alicloud_security_group_rules', data_source_argument='rules', data_source='{"group_id": "group_id", "resource_id": "group_id"}', data_source_output='{"nic_type": {"convert": "nic_type", "allow_null": 1, "type": "string"}, "cidr_ip": {"convert": "source_cidr_ip", "allow_null": 0, "type": "string"}, "ip_protocol": {"convert": "ip_protocol", "allow_null": 0, "type": "string"}, "security_group_id": {"convert": "security_group_id", "allow_null": 0, "type": "string"}, "priority": {"convert": "priority", "allow_null": 1, "type": "string"}, "policy": {"convert": "policy", "allow_null": 0, "type": "string"}, "vpc_id": "-", "type": {"convert": "type", "allow_null": 0, "type": "string"}, "ports": {"convert": "port_range", "allow_null": 0, "type": "string"}, "description": {"convert": "dest_cidr_ip", "allow_null": 1, "type": "string"}}' WHERE id='818f6c1089b1493294dad141846943b6'; @@ -72,7 +72,8 @@ UPDATE terraform.resource SET provider='tencentcloud', resource_type='lb_attach UPDATE terraform.resource SET provider='alicloud', resource_type='instance', resource_name='alicloud_instance', extend_info='{"system_disk_name": {"type": "string"}, "description": "create from terraform"}', resource_property='{"charge_type": "internet_charge_type", "password": {"convert": "password", "allow_null": 0, "type": "string"}, "disk_size": {"default": 40, "convert": "system_disk_size", "allow_null": 0, "type": "int"}, "name": {"convert": "instance_name", "allow_null": 0, "type": "string"}, "zone": {"convert": "availability_zone", "allow_null": 0, "type": "string"}, "subnet_id": {"convert": "vswitch_id", "allow_null": 0, "type": "string"}, "force_delete": {"convert": "force_delete", "allow_null": 1, "type": "bool"}, "image": {"convert": "image_id", "allow_null": 0, "type": "string"}, "hostname": {"convert": "host_name", "allow_null": 1, "type": "string"}, "security_group_id": {"convert": "security_groups", "allow_null": 1, "type": "list"}, "instance_type": {"convert": "instance_type", "allow_null": 0, "type": "string"}, "vpc_id": "-", "disk_type": {"default": "cloud_essd", "convert": "system_disk_category", "allow_null": 0, "type": "string"}, "power_action": {"convert": "status", "allow_null": 1, "type": "string"}, "data_disks": {"convert": "data_disks", "allow_null": 1, "type": "json"}}', resource_output='{"public_ip": "public_ip", "ipaddress": "private_ip", "resource_id": "id"}', data_source_name='alicloud_instances', data_source_argument='instances', data_source='{"zone": "availability_zone", "resource_id": {"convert": "ids", "type": "list"}, "subnet_id": "vswith_id", "public_ip": "-", "image_id": "image_id", "tag": {"convert": "tags", "type": "json"}, "vpc_id": "vpc_id", "ipaddress": "-"}', data_source_output='{"charge_type": "internet_charge_type", "password": {"convert": "password", "allow_null": 0, "type": "string"}, "disk_size": {"default": 40, "convert": "system_disk_size", "allow_null": 0, "type": "int"}, "name": {"convert": "instance_name", "allow_null": 0, "type": "string"}, "zone": {"convert": "availability_zone", "allow_null": 0, "type": "string"}, "resource_id": "id", "subnet_id": {"convert": "vswitch_id", "allow_null": 0, "type": "string"}, "force_delete": {"convert": "force_delete", "allow_null": 1, "type": "bool"}, "image": {"convert": "image_id", "allow_null": 0, "type": "string"}, "hostname": {"convert": "host_name", "allow_null": 1, "type": "string"}, "security_group_id": {"convert": "security_groups", "allow_null": 1, "type": "list"}, "public_ip": "public_ip", "instance_type": {"convert": "instance_type", "allow_null": 0, "type": "string"}, "ipaddress": "private_ip", "vpc_id": "-", "disk_type": {"default": "cloud_essd", "convert": "system_disk_category", "allow_null": 0, "type": "string"}, "power_action": {"convert": "status", "allow_null": 1, "type": "string"}, "data_disks": {"convert": "data_disks", "allow_null": 1, "type": "json"}}' WHERE id='cc70229a569c46dda38e64ca848002bf'; UPDATE terraform.resource SET provider='tencentcloud', resource_type='instance', resource_name='tencentcloud_instance', extend_info='{"tags": {"type": "json"}}', resource_property='{"charge_type": "instance_charge_type", "password": {"convert": "password", "allow_null": 0, "type": "string"}, "disk_size": {"convert": "system_disk_size", "allow_null": 0, "type": "string"}, "name": {"convert": "instance_name", "allow_null": 0, "type": "string"}, "zone": {"convert": "availability_zone", "allow_null": 0, "type": "string"}, "subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "force_delete": {"convert": "force_delete", "allow_null": 1, "type": "bool"}, "image": {"convert": "image_id", "allow_null": 0, "type": "string"}, "hostname": {"convert": "hostname", "allow_null": 0, "type": "string"}, "security_group_id": {"convert": "security_groups", "allow_null": 1, "type": "list"}, "instance_type": {"convert": "instance_type", "allow_null": 0, "type": "string"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "disk_type": {"convert": "system_disk_type", "allow_null": 0, "type": "string"}, "power_action": {"convert": "running_flag", "allow_null": 1, "type": "bool"}, "data_disks": {"convert": "data_disks", "allow_null": 1, "type": "json"}, "internet_charge_type": "internet_charge_type"}', resource_output='{"public_ip": "public_ip", "ipaddress": "private_ip", "resource_id": "id"}', data_source_name='tencentcloud_instances', data_source_argument='instance_list', data_source='{"zone": "availability_zone", "resource_id": "instance_id", "subnet_id": "subnet_id", "public_ip": "-", "image_id": "-", "tag": "tags", "vpc_id": "vpc_id", "ipaddress": "-"}', data_source_output='{"charge_type": "instance_charge_type", "password": {"convert": "password", "allow_null": 0, "type": "string"}, "disk_size": {"convert": "system_disk_size", "allow_null": 0, "type": "string"}, "name": {"convert": "instance_name", "allow_null": 0, "type": "string"}, "zone": {"convert": "availability_zone", "allow_null": 0, "type": "string"}, "resource_id": "instance_id", "subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "force_delete": {"convert": "force_delete", "allow_null": 1, "type": "bool"}, "image": {"convert": "image_id", "allow_null": 0, "type": "string"}, "hostname": {"convert": "hostname", "allow_null": 0, "type": "string"}, "security_group_id": {"convert": "security_groups", "allow_null": 1, "type": "list"}, "public_ip": "public_ip", "instance_type": {"convert": "instance_type", "allow_null": 0, "type": "string"}, "power_action": {"convert": "running_flag", "allow_null": 1, "type": "bool"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "disk_type": {"convert": "system_disk_type", "allow_null": 0, "type": "string"}, "ipaddress": "private_ip", "data_disks": {"convert": "data_disks", "allow_null": 1, "type": "json"}, "internet_charge_type": "internet_charge_type"}' WHERE id='cd96fd53ee8b421fa8549103abe2d5e6'; UPDATE terraform.resource SET provider='alicloud', resource_type='mysql_database', resource_name='alicloud_db_database', extend_info='{"description": "from terraform"}', resource_property='{"mysql_id": {"convert": "instance_id", "allow_null": 0, "type": "string"}, "name": {"convert": "name", "allow_null": 0, "type": "string"}}', resource_output='{"resource_id": "id"}', data_source_name='', data_source_argument='', data_source='{}', data_source_output='{}' WHERE id='ce87aefd26f243f2b4e0fbee4823d1b9'; -UPDATE terraform.resource SET provider='tencentcloud', resource_type='lb', resource_name='tencentcloud_clb_instance', extend_info='{"tags": {"type": "json"}}', resource_property='{"subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "network_type": {"default": "INTERNAL", "convert": "network_type", "allow_null": 1, "type": "string"}, "name": {"convert": "clb_name", "allow_null": 0, "type": "string"}, "charge_type": "internet_charge_type"}', resource_output='{"ipaddress": "clb_vips", "resource_id": "id"}', data_source_name='tencentcloud_clb_instances', data_source_argument='clb_list', data_source='{"name": "clb_name", "resource_id": "clb_id", "subnet_id": "-", "tag": "-", "vpc_id": "-", "ipaddress": "-"}', data_source_output='{"charge_type": "internet_charge_type", "name": {"convert": "clb_name", "allow_null": 0, "type": "string"}, "resource_id": "clb_id", "subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "ipaddress": "clb_vips", "network_type": {"default": "INTERNAL", "convert": "network_type", "allow_null": 1, "type": "string"}}' WHERE id='da1c168374ae4dbc9fabf889630355be'; +UPDATE terraform.resource SET provider='tencentcloud', resource_type='lb', resource_name='tencentcloud_clb_instance', extend_info='{"tags": {"type": "json"}}', resource_property='{"subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "vpc_id": {"convert": "vpc_id", "allow_null": 1, "type": "string"}, "network_type": {"default": "INTERNAL", "convert": "network_type", "allow_null": 1, "type": "string"}, "name": {"convert": "clb_name", "allow_null": 0, "type": "string"}, "charge_type": "internet_charge_type"}', resource_output='{"ipaddress": "clb_vips", "resource_id": "id"}', data_source_name='tencentcloud_clb_instances', data_source_argument='clb_list', data_source='{"name": "clb_name", "resource_id": "clb_id", "subnet_id": "-", "tag": "-", "vpc_id": "-", "ipaddress": "-"}', data_source_output='{"charge_type": {"default": "TRAFFIC_POSTPAID_BY_HOUR", "convert": "internet_charge_type", "allow_null": "0", "type": "string"}, "name": {"convert": "clb_name", "allow_null": 0, "type": "string"}, "resource_id": "clb_id", "subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "ipaddress": "clb_vips", "network_type": {"default": "INTERNAL", "convert": "network_type", "allow_null": 1, "type": "string"}}' WHERE id='da1c168374ae4dbc9fabf889630355be'; +UPDATE terraform.resource SET provider='tencentcloud', resource_type='nat', resource_name='tencentcloud_nat_gateway', extend_info='{}', resource_property='{"subnet_id": "-", "vpc_id": "vpc_id", "name": "name", "eip": {"convert": "assigned_eip_set", "type": "list"}}', resource_output='{"resource_id": "id"}', data_source_name='tencentcloud_nat_gateways', data_source_argument='nats', data_source='{"vpc_id": "vpc_id", "name": "name", "resource_id": "id"}', data_source_output='{"subnet_id": "-", "vpc_id": "vpc_id", "name": "name", "eip": {"convert": "assigned_eip_set", "type": "list"}, "resource_id": "id"}' WHERE id='dc961b78fdc2483880c504c77042af96'; UPDATE terraform.resource SET provider='tencentcloud', resource_type='network_interface', resource_name='tencentcloud_eni', extend_info='{"ipv4_count": 1, "description": "create from terraform"}', resource_property='{"subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "ipaddress": {"convert": "ipv4s", "allow_null": 1, "type": "string"}, "name": {"convert": "name", "allow_null": 0, "type": "string"}, "security_group_id": {"convert": "storage_id", "allow_null": 1, "type": "list"}}', resource_output='{"ipaddress": "ipv4_info.0.ip", "resource_id": "id"}', data_source_name='tencentcloud_enis', data_source_argument='enis', data_source='{"name": "name", "resource_id": {"convert": "ids", "type": "list"}, "subnet_id": "subnet_id", "public_ip": "-", "tag": "tags", "vpc_id": "vpc_id", "ipaddress": "-"}', data_source_output='{"name": {"convert": "name", "allow_null": 0, "type": "string"}, "resource_id": "id", "subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "security_group_id": {"convert": "storage_id", "allow_null": 1, "type": "list"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "ipaddress": {"convert": "ipv4s", "allow_null": 1, "type": "string"}}' WHERE id='dd15c84a54434f6685b9ae560b9121c2'; UPDATE terraform.resource SET provider='tencentcloud', resource_type='lb_listener', resource_name='tencentcloud_clb_listener', extend_info='{}', resource_property='{"health_check": {"convert": "health_check_switch", "allow_null": 1, "type": "bool"}, "protocol": {"default": "HTTP", "convert": "protocol", "allow_null": 1, "type": "string"}, "name": {"convert": "listener_name", "allow_null": 0, "type": "string"}, "health_check_uri": {"convert": "health_check_http_path", "allow_null": 1, "type": "string"}, "lb_id": {"convert": "clb_id", "allow_null": 0, "type": "string"}, "port": {"convert": "port", "allow_null": 0, "type": "int"}, "backend_port": "-"}', resource_output='{"resource_id": "listener_id"}', data_source_name='', data_source_argument='', data_source='{}', data_source_output='{}' WHERE id='dff77ee8e0794c07bcde4eb6df88ba9e'; UPDATE terraform.resource SET provider='tencentcloud', resource_type='ccn_attach', resource_name='tencentcloud_ccn_attachment', extend_info='{}', resource_property='{"instance_id": {"convert": "instance_id", "allow_null": 0, "type": "string"}, "instance_type": {"default": "VPC", "convert": "instance_type", "allow_null": 1, "type": "string"}, "ccn_id": {"convert": "ccn_id", "allow_null": 0, "type": "string"}, "instance_region": {"convert": "instance_region", "allow_null": 0, "type": "string"}}', resource_output='{"resource_id": "id"}', data_source_name='', data_source_argument='', data_source='{}', data_source_output='{}' WHERE id='e43bbc476ee946faa1bc1cd845ef33d4'; From e8ca88fc268c065de2ecfeb867b79015f3c971ab Mon Sep 17 00:00:00 2001 From: comprelzhang Date: Fri, 7 May 2021 16:40:04 +0800 Subject: [PATCH 08/12] =?UTF-8?q?[update]=20route=20entry=20=E8=B7=B3?= =?UTF-8?q?=E8=BF=87=E7=A9=BA=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/network/route_entry.py | 64 +++++++++++++++++++++-- apps/background/resource/resource_base.py | 6 +++ 2 files changed, 65 insertions(+), 5 deletions(-) diff --git a/apps/api/network/route_entry.py b/apps/api/network/route_entry.py index 3654afb2..98a07bb1 100644 --- a/apps/api/network/route_entry.py +++ b/apps/api/network/route_entry.py @@ -6,9 +6,9 @@ from lib.logs import logger from lib.json_helper import format_json_dumps from apps.common.convert_keys import define_relations_key -from apps.api.apibase import ApiBase -from apps.api.configer.provider import ProviderApi from apps.background.resource.resource_base import CrsObject +from apps.api.apibase import ApiBase +from apps.api.conductor.valueReverse import ValueResetConductor from apps.api.apibase_backend import ApiBackendBase @@ -25,29 +25,33 @@ def before_keys_checks(self, provider, create_data, is_update=None): vpc_id = create_data.get("vpc_id") route_table_id = create_data.get("route_table_id") + next_hub = create_data.get("next_hub") self.resource_info(provider) resource_property = self.resource_keys_config["resource_property"] _vpc_status = define_relations_key("vpc_id", vpc_id, resource_property.get("vpc_id")) _rt_status = define_relations_key("route_table_id", route_table_id, resource_property.get("route_table_id")) + _ne_status = define_relations_key("next_hub", next_hub, resource_property.get("next_hub")) ext_info = {} if vpc_id and (not _vpc_status): ext_info["vpc_id"] = CrsObject("vpc").object_resource_id(vpc_id) if route_table_id and (not _rt_status): ext_info["route_table_id"] = CrsObject(self.owner_resource).object_resource_id(route_table_id) + if next_hub and (not _ne_status): + ext_info["next_hub"] = CrsObject(self.owner_resource).object_resource_assetid(next_hub) logger.info("before_keys_checks add info: %s" % (format_json_dumps(ext_info))) return ext_info def generate_create_data(self, zone, create_data, **kwargs): r_create_data = {"vpc_id": create_data.get("vpc_id"), + "next_hub": create_data.get("next_hub"), "route_table_id": create_data.get("route_table_id")} create_data = {"name": create_data.get("name"), "destination": create_data.get("destination"), "next_type": create_data.get("next_type"), - "next_hub": create_data.get("next_hub") } return create_data, r_create_data @@ -77,12 +81,62 @@ def __init__(self): self.resource_keys_config = None def before_source_asset(self, provider, query_data): - for key in ["route_table_id", "vpc_id"]: + for key in ["route_table_id", "vpc_id", "next_hub"]: if query_data.get(key): query_data[key] = CrsObject().object_asset_id(query_data.get(key)) return query_data def reverse_asset_ids(self): - return ['vpc_id', "route_table_id"] + return ['vpc_id', "route_table_id", "next_hub"] + + def run_query(self, rid, region, zone, + provider_object, provider_info, + query_data, **kwargs): + ''' + + :param rid: + :param region: + :param zone: + :param owner_id: + :param relation_id: + :param create_data: + :param extend_info: + :param kwargs: + :return: + ''' + + # extend_info = extend_info or {} + label_name = self.resource_name + "_q_" + rid + + define_json, resource_keys_config = self.source_filter_controller(provider_name=provider_object["name"], + label_name=label_name, + query_data=query_data + ) + + result = self._run_create_and_read_result(rid, provider=provider_object["name"], + region=region, provider_info=provider_info, + define_json=define_json) + + data_source_argument = resource_keys_config.get("data_source_argument") + output_json = self.read_query_result_controller(provider_object["name"], result, + data_source_argument) + + result_list = [] + for out_data in output_json: + count = 0 + for _, x_value in out_data.items(): + if not x_value: + count += 1 + if count == len(out_data): + logger.info("out data columns is null, skip ...") + continue + + x_json = ValueResetConductor().reset_values(provider=provider_object["name"], + resource_name=self.resource_name, + data=out_data) + + x_json = self.reverse_asset_object(provider=provider_object["name"], data=x_json) + result_list.append(x_json) + return result_list diff --git a/apps/background/resource/resource_base.py b/apps/background/resource/resource_base.py index defed97b..25c23653 100644 --- a/apps/background/resource/resource_base.py +++ b/apps/background/resource/resource_base.py @@ -184,6 +184,12 @@ def object_resource_id(self, rid): raise local_exceptions.ValueValidateError(self.resource_name, "资源 %s 不存在" % rid) return data["resource_id"] + def object_resource_assetid(self, rid): + data = self.show(rid) + if not data: + return rid + return data["resource_id"] + def object_asset_id(self, rid): data = self.show(rid) if data: From 38cefcafa2545c6ad73d6ac164b06c1880bd6b97 Mon Sep 17 00:00:00 2001 From: comprelzhang Date: Fri, 7 May 2021 17:12:49 +0800 Subject: [PATCH 09/12] =?UTF-8?q?[update]=20=E6=9B=B4=E6=96=B0nat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/network/nat_gateway.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/api/network/nat_gateway.py b/apps/api/network/nat_gateway.py index 88515ec5..5d60dfa7 100644 --- a/apps/api/network/nat_gateway.py +++ b/apps/api/network/nat_gateway.py @@ -52,7 +52,8 @@ def generate_create_data(self, zone, create_data, **kwargs): "subnet_id": create_data.get("subnet_id")} create_data = {"eip": create_data.get("eip"), - "name": create_data.get("name")} + "name": create_data.get("name"), + "bandwidth": create_data.get("bandwidth")} return create_data, r_create_data From 9547589e55a58ad1e521091d96a39b9864f654c2 Mon Sep 17 00:00:00 2001 From: comprelzhang Date: Fri, 7 May 2021 17:18:50 +0800 Subject: [PATCH 10/12] =?UTF-8?q?[update]=E6=9B=B4=E6=96=B0xml=20register?= =?UTF-8?q?=20lb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- register.xml | 79 ---------------------------------------------------- 1 file changed, 79 deletions(-) diff --git a/register.xml b/register.xml index cc6bf213..4d8da638 100644 --- a/register.xml +++ b/register.xml @@ -1185,85 +1185,6 @@ charge_type - - - id - name - secret - provider - lb_id - port - protocol - backend_port - health_check - health_check_uri - zone - region - asset_id - resource_id - extend_info - - - errorMessage - errorCode - id - resource_id - - - - - id - - - result - errorMessage - errorCode - - - - - id - name - secret - provider - lb_id - listener_id - backend_servers - instance_id - weight - port - zone - region - extend_info - - - errorMessage - errorCode - id - resource_id - - - - - id - - - result - errorMessage - errorCode - - - - - id - instance_id - - - result - errorMessage - errorCode - - From a4533b6bab38219d233153115d25faf60d6a0db4 Mon Sep 17 00:00:00 2001 From: comprelzhang Date: Fri, 7 May 2021 17:32:02 +0800 Subject: [PATCH 11/12] =?UTF-8?q?[update]=E6=9B=B4=E6=96=B0=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=9D=A1=E4=BB=B6=E8=BF=94=E5=9B=9E=EF=BC=8C=20?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/apibase_backend.py | 1 + doc/update.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/api/apibase_backend.py b/apps/api/apibase_backend.py index bc533784..e0d4da5c 100644 --- a/apps/api/apibase_backend.py +++ b/apps/api/apibase_backend.py @@ -682,6 +682,7 @@ def run_query(self, rid, region, zone, data=out_data) x_json = self.reverse_asset_object(provider=provider_object["name"], data=x_json) + x_json.update(query_data) if x_json.get("instance_type"): instance_type, resource_info = InstanceTypeObject().convert_asset(provider=provider_object["name"], diff --git a/doc/update.sql b/doc/update.sql index c2e57c19..2a19e53f 100644 --- a/doc/update.sql +++ b/doc/update.sql @@ -73,7 +73,7 @@ UPDATE terraform.resource SET provider='alicloud', resource_type='instance', re UPDATE terraform.resource SET provider='tencentcloud', resource_type='instance', resource_name='tencentcloud_instance', extend_info='{"tags": {"type": "json"}}', resource_property='{"charge_type": "instance_charge_type", "password": {"convert": "password", "allow_null": 0, "type": "string"}, "disk_size": {"convert": "system_disk_size", "allow_null": 0, "type": "string"}, "name": {"convert": "instance_name", "allow_null": 0, "type": "string"}, "zone": {"convert": "availability_zone", "allow_null": 0, "type": "string"}, "subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "force_delete": {"convert": "force_delete", "allow_null": 1, "type": "bool"}, "image": {"convert": "image_id", "allow_null": 0, "type": "string"}, "hostname": {"convert": "hostname", "allow_null": 0, "type": "string"}, "security_group_id": {"convert": "security_groups", "allow_null": 1, "type": "list"}, "instance_type": {"convert": "instance_type", "allow_null": 0, "type": "string"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "disk_type": {"convert": "system_disk_type", "allow_null": 0, "type": "string"}, "power_action": {"convert": "running_flag", "allow_null": 1, "type": "bool"}, "data_disks": {"convert": "data_disks", "allow_null": 1, "type": "json"}, "internet_charge_type": "internet_charge_type"}', resource_output='{"public_ip": "public_ip", "ipaddress": "private_ip", "resource_id": "id"}', data_source_name='tencentcloud_instances', data_source_argument='instance_list', data_source='{"zone": "availability_zone", "resource_id": "instance_id", "subnet_id": "subnet_id", "public_ip": "-", "image_id": "-", "tag": "tags", "vpc_id": "vpc_id", "ipaddress": "-"}', data_source_output='{"charge_type": "instance_charge_type", "password": {"convert": "password", "allow_null": 0, "type": "string"}, "disk_size": {"convert": "system_disk_size", "allow_null": 0, "type": "string"}, "name": {"convert": "instance_name", "allow_null": 0, "type": "string"}, "zone": {"convert": "availability_zone", "allow_null": 0, "type": "string"}, "resource_id": "instance_id", "subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "force_delete": {"convert": "force_delete", "allow_null": 1, "type": "bool"}, "image": {"convert": "image_id", "allow_null": 0, "type": "string"}, "hostname": {"convert": "hostname", "allow_null": 0, "type": "string"}, "security_group_id": {"convert": "security_groups", "allow_null": 1, "type": "list"}, "public_ip": "public_ip", "instance_type": {"convert": "instance_type", "allow_null": 0, "type": "string"}, "power_action": {"convert": "running_flag", "allow_null": 1, "type": "bool"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "disk_type": {"convert": "system_disk_type", "allow_null": 0, "type": "string"}, "ipaddress": "private_ip", "data_disks": {"convert": "data_disks", "allow_null": 1, "type": "json"}, "internet_charge_type": "internet_charge_type"}' WHERE id='cd96fd53ee8b421fa8549103abe2d5e6'; UPDATE terraform.resource SET provider='alicloud', resource_type='mysql_database', resource_name='alicloud_db_database', extend_info='{"description": "from terraform"}', resource_property='{"mysql_id": {"convert": "instance_id", "allow_null": 0, "type": "string"}, "name": {"convert": "name", "allow_null": 0, "type": "string"}}', resource_output='{"resource_id": "id"}', data_source_name='', data_source_argument='', data_source='{}', data_source_output='{}' WHERE id='ce87aefd26f243f2b4e0fbee4823d1b9'; UPDATE terraform.resource SET provider='tencentcloud', resource_type='lb', resource_name='tencentcloud_clb_instance', extend_info='{"tags": {"type": "json"}}', resource_property='{"subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "vpc_id": {"convert": "vpc_id", "allow_null": 1, "type": "string"}, "network_type": {"default": "INTERNAL", "convert": "network_type", "allow_null": 1, "type": "string"}, "name": {"convert": "clb_name", "allow_null": 0, "type": "string"}, "charge_type": "internet_charge_type"}', resource_output='{"ipaddress": "clb_vips", "resource_id": "id"}', data_source_name='tencentcloud_clb_instances', data_source_argument='clb_list', data_source='{"name": "clb_name", "resource_id": "clb_id", "subnet_id": "-", "tag": "-", "vpc_id": "-", "ipaddress": "-"}', data_source_output='{"charge_type": {"default": "TRAFFIC_POSTPAID_BY_HOUR", "convert": "internet_charge_type", "allow_null": "0", "type": "string"}, "name": {"convert": "clb_name", "allow_null": 0, "type": "string"}, "resource_id": "clb_id", "subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "ipaddress": "clb_vips", "network_type": {"default": "INTERNAL", "convert": "network_type", "allow_null": 1, "type": "string"}}' WHERE id='da1c168374ae4dbc9fabf889630355be'; -UPDATE terraform.resource SET provider='tencentcloud', resource_type='nat', resource_name='tencentcloud_nat_gateway', extend_info='{}', resource_property='{"subnet_id": "-", "vpc_id": "vpc_id", "name": "name", "eip": {"convert": "assigned_eip_set", "type": "list"}}', resource_output='{"resource_id": "id"}', data_source_name='tencentcloud_nat_gateways', data_source_argument='nats', data_source='{"vpc_id": "vpc_id", "name": "name", "resource_id": "id"}', data_source_output='{"subnet_id": "-", "vpc_id": "vpc_id", "name": "name", "eip": {"convert": "assigned_eip_set", "type": "list"}, "resource_id": "id"}' WHERE id='dc961b78fdc2483880c504c77042af96'; +UPDATE terraform.resource SET provider='tencentcloud', resource_type='nat', resource_name='tencentcloud_nat_gateway', extend_info='{}', resource_property='{"subnet_id": "-", "vpc_id": "vpc_id", "bandwidth": {"convert": "bandwidth", "allow_null": 1, "type": "int"}, "name": "name", "eip": {"convert": "assigned_eip_set", "allow_null": 1, "type": "list"}}', resource_output='{"resource_id": "id"}', data_source_name='tencentcloud_nat_gateways', data_source_argument='nats', data_source='{"vpc_id": "vpc_id", "name": "name", "resource_id": "id"}', data_source_output='{"eip": {"convert": "assigned_eip_set", "allow_null": 1, "type": "list"}, "name": "name", "resource_id": "id", "subnet_id": "-", "bandwidth": {"convert": "bandwidth", "allow_null": 1, "type": "string"}, "vpc_id": "vpc_id"}' WHERE id='dc961b78fdc2483880c504c77042af96'; UPDATE terraform.resource SET provider='tencentcloud', resource_type='network_interface', resource_name='tencentcloud_eni', extend_info='{"ipv4_count": 1, "description": "create from terraform"}', resource_property='{"subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "ipaddress": {"convert": "ipv4s", "allow_null": 1, "type": "string"}, "name": {"convert": "name", "allow_null": 0, "type": "string"}, "security_group_id": {"convert": "storage_id", "allow_null": 1, "type": "list"}}', resource_output='{"ipaddress": "ipv4_info.0.ip", "resource_id": "id"}', data_source_name='tencentcloud_enis', data_source_argument='enis', data_source='{"name": "name", "resource_id": {"convert": "ids", "type": "list"}, "subnet_id": "subnet_id", "public_ip": "-", "tag": "tags", "vpc_id": "vpc_id", "ipaddress": "-"}', data_source_output='{"name": {"convert": "name", "allow_null": 0, "type": "string"}, "resource_id": "id", "subnet_id": {"convert": "subnet_id", "allow_null": 0, "type": "string"}, "security_group_id": {"convert": "storage_id", "allow_null": 1, "type": "list"}, "vpc_id": {"convert": "vpc_id", "allow_null": 0, "type": "string"}, "ipaddress": {"convert": "ipv4s", "allow_null": 1, "type": "string"}}' WHERE id='dd15c84a54434f6685b9ae560b9121c2'; UPDATE terraform.resource SET provider='tencentcloud', resource_type='lb_listener', resource_name='tencentcloud_clb_listener', extend_info='{}', resource_property='{"health_check": {"convert": "health_check_switch", "allow_null": 1, "type": "bool"}, "protocol": {"default": "HTTP", "convert": "protocol", "allow_null": 1, "type": "string"}, "name": {"convert": "listener_name", "allow_null": 0, "type": "string"}, "health_check_uri": {"convert": "health_check_http_path", "allow_null": 1, "type": "string"}, "lb_id": {"convert": "clb_id", "allow_null": 0, "type": "string"}, "port": {"convert": "port", "allow_null": 0, "type": "int"}, "backend_port": "-"}', resource_output='{"resource_id": "listener_id"}', data_source_name='', data_source_argument='', data_source='{}', data_source_output='{}' WHERE id='dff77ee8e0794c07bcde4eb6df88ba9e'; UPDATE terraform.resource SET provider='tencentcloud', resource_type='ccn_attach', resource_name='tencentcloud_ccn_attachment', extend_info='{}', resource_property='{"instance_id": {"convert": "instance_id", "allow_null": 0, "type": "string"}, "instance_type": {"default": "VPC", "convert": "instance_type", "allow_null": 1, "type": "string"}, "ccn_id": {"convert": "ccn_id", "allow_null": 0, "type": "string"}, "instance_region": {"convert": "instance_region", "allow_null": 0, "type": "string"}}', resource_output='{"resource_id": "id"}', data_source_name='', data_source_argument='', data_source='{}', data_source_output='{}' WHERE id='e43bbc476ee946faa1bc1cd845ef33d4'; From 9496adf85b7ea0732d49679fdbe9c38e9c8100f8 Mon Sep 17 00:00:00 2001 From: comprelzhang Date: Sat, 8 May 2021 10:04:23 +0800 Subject: [PATCH 12/12] =?UTF-8?q?[update]=E6=9B=B4=E6=96=B0route=20entry?= =?UTF-8?q?=20=20route=20table=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/apibase_backend.py | 2 +- .../network/route_entry_controller.py | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/apps/api/apibase_backend.py b/apps/api/apibase_backend.py index e0d4da5c..2f479238 100644 --- a/apps/api/apibase_backend.py +++ b/apps/api/apibase_backend.py @@ -682,7 +682,7 @@ def run_query(self, rid, region, zone, data=out_data) x_json = self.reverse_asset_object(provider=provider_object["name"], data=x_json) - x_json.update(query_data) + # x_json.update(query_data) if x_json.get("instance_type"): instance_type, resource_info = InstanceTypeObject().convert_asset(provider=provider_object["name"], diff --git a/apps/controller/network/route_entry_controller.py b/apps/controller/network/route_entry_controller.py index c2e6ef91..604963ac 100644 --- a/apps/controller/network/route_entry_controller.py +++ b/apps/controller/network/route_entry_controller.py @@ -7,6 +7,10 @@ from core.controller import BackendIdController from core.controller import BaseController from lib.uuid_util import get_uuid +from lib.logs import logger +from core.response_hooks import format_string +from apps.controller.configer.model_args import source_columns_outputs +from apps.api.configer.region import ZoneApi from apps.api.network.route_entry import RouteEntryApi from apps.api.network.route_entry import RouteEntryBackendApi from apps.controller.source_controller import BaseSourceController @@ -167,3 +171,58 @@ class RTRuleSourceController(BaseSourceController): allow_methods = ("POST",) resource = RouteEntryBackendApi() + def one_query(self, rid, provider, region, zone, secret, + resource_id, ignore_ids, **kwargs): + ''' + + :param rid: + :param provider: + :param region: + :param zone: + :param secret: + :param resource_id: + :param ignore_ids: + :param kwargs: + :return: + ''' + + result = self.fetch_source(rid=rid, provider=provider, region=region, zone=zone, + secret=secret, resource_id=resource_id, + **kwargs) + result_data = [] + + register_zones = ZoneApi().region_zones(region, provider) + + for x_result in result: + x_res = source_columns_outputs(self.resource.resource_name) + x_res.update(x_result) + + route_table_id = kwargs.get("route_table_id") + if not x_res.get("route_table_id") and route_table_id: + x_res["route_table_id"] = route_table_id + + res = {"region": region, "secret": secret, "provider": provider} + + if x_res.get("resource_id") in ignore_ids: + continue + + if x_res.get("zone") and (x_res.get("zone") not in register_zones): + logger.info("resource: %s ,zone: %s searched not in register zone, skip it" % ( + x_res.get("resource_id"), x_res.get("zone"))) + if x_res.get("x_ora_zone") and (x_res.get("x_ora_zone") not in register_zones): + continue + + x_res.pop("x_ora_zone", None) + + for x, value in x_res.items(): + if isinstance(value, dict): + res[x] = format_string(value) + else: + if value is None: + res[x] = '' + else: + res[x] = str(value) + + result_data.append(res) + + return result_data