diff --git a/solution/tech-solution/real-time-log-analysis-with-selectdb/README.md b/solution/tech-solution/real-time-log-analysis-with-selectdb/README.md new file mode 100644 index 000000000..7861be0cd --- /dev/null +++ b/solution/tech-solution/real-time-log-analysis-with-selectdb/README.md @@ -0,0 +1,46 @@ +## Introduction + +本示例用于实现解决方案[SelectDB实现日志高效存储与实时分析](https://www.aliyun.com/solution/tech-solution/real-time-log-analysis-with-selectdb),涉及专有网络(VPC)、交换机(VSwitch)、云服务器(ECS)、SelectDB数据库(SelectDB)等资源的部署。 + + + +This example is used to implement solution [SelectDB enables efficient log storage and real-time analytics](https://www.aliyun.com/solution/tech-solution/real-time-log-analysis-with-selectdb), which involves the creation and deployment of resources such as Virtual Private Cloud (VPC), Virtual Switch (VSwitch), Elastic Compute Service (ECS), SelectDB Database (SelectDB). + + + +## Providers + +| Name | Version | +|------|---------| +| [alicloud](#provider\_alicloud) | n/a | +| [random](#provider\_random) | n/a | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [alicloud_ecs_command.run_tpcc_alicloud_ecs_command](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/ecs_command) | resource | +| [alicloud_ecs_invocation.run_tpcc_alicloud_ecs_invocation](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/ecs_invocation) | resource | +| [alicloud_instance.ecs_instance](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/instance) | resource | +| [alicloud_security_group.sg_select](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/security_group) | resource | +| [alicloud_selectdb_db_instance.selectdb_instance](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/selectdb_db_instance) | resource | +| [alicloud_vpc.vpc_select](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/vpc) | resource | +| [alicloud_vswitch.vsw_select](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/vswitch) | resource | +| [random_id.suffix](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) | resource | +| [alicloud_images.image_id](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/data-sources/images) | data source | +| [alicloud_zones.default](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/data-sources/zones) | data source | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [db\_password](#input\_db\_password) | SelectDB admin账号密码 | `string` | n/a | yes | +| [ecs\_instance\_password](#input\_ecs\_instance\_password) | ECS服务器root账号密码 | `string` | n/a | yes | +| [instance\_class](#input\_instance\_class) | SelectDB实例规格 | `string` | `"selectdb.4xlarge"` | no | +| [instance\_type](#input\_instance\_type) | ECS实例类型,建议选择配备 16 vCPU 64 GiB 配置的实例 | `string` | `"ecs.g8i.4xlarge"` | no | +| [selectdb\_engine\_version](#input\_selectdb\_engine\_version) | SelectDB内核版本 | `string` | `"4.0.4"` | no | + \ No newline at end of file diff --git a/solution/tech-solution/real-time-log-analysis-with-selectdb/main.tf b/solution/tech-solution/real-time-log-analysis-with-selectdb/main.tf new file mode 100644 index 000000000..30c62ce80 --- /dev/null +++ b/solution/tech-solution/real-time-log-analysis-with-selectdb/main.tf @@ -0,0 +1,115 @@ +# ------------------------------------------------------------------------------ +# 核心资源定义 +# +# 本文件包含了模块的核心基础设施资源 +# 这里的代码负责根据输入变量来创建和配置所有云资源 +# ------------------------------------------------------------------------------ + +# 配置阿里云提供商 +provider "alicloud" { + region = "cn-hangzhou" +} + +# 创建随机ID用于资源命名 +resource "random_id" "suffix" { + byte_length = 8 +} + +# 定义本地变量common_name +locals { + common_name = "SelectDB-${random_id.suffix.id}" + ecs_command = <= 8 && length(var.ecs_instance_password) <= 30 + error_message = "长度8-30,必须包含三项(大写字母、小写字母、数字、 !@#$%^&*()_+-=中的特殊符号)" + } +} + +# SelectDB实例规格 +variable "instance_class" { + type = string + default = "selectdb.4xlarge" + description = "SelectDB实例规格" +} + +# SelectDB内核版本 +variable "selectdb_engine_version" { + type = string + default = "4.0.4" + description = "SelectDB内核版本" + validation { + condition = contains(["3.0.12", "4.0.4"], var.selectdb_engine_version) + error_message = "无效的配置信息,请检查并重新输入" + } +} + +# SelectDB admin账号密码 +variable "db_password" { + type = string + sensitive = true + description = "SelectDB admin账号密码" + #default = "" + validation { + condition = can(regex("^[0-9A-Za-z_!@#$%^&*()_+\\-=\\+]+$", var.db_password)) && length(var.db_password) >= 8 && length(var.db_password) <= 30 + error_message = "长度8-30,必须包含三项(大写字母、小写字母、数字、 !@#$%^&*()_+-=中的特殊符号)" + } +} \ No newline at end of file