Skip to content

Commit 208fbca

Browse files
CodeArtisanXshanye997
authored andcommitted
add tech-solution hologres-olap
1 parent 364247b commit 208fbca

File tree

4 files changed

+158
-0
lines changed

4 files changed

+158
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Introduction
2+
<!-- DOCS_DESCRIPTION_CN -->
3+
本示例用于实现解决方案[高性能,搭建轻量 OLAP 分析平台](https://www.aliyun.com/solution/tech-solution/hologres-olap),涉及专有网络(VPC)、交换机(VSwitch)、实时数仓 Hologres(Hologres)等资源的部署。
4+
<!-- DOCS_DESCRIPTION_CN -->
5+
6+
<!-- DOCS_DESCRIPTION_EN -->
7+
This example is used to implement solution [Build a high-performance, lightweight OLAP platform](https://www.aliyun.com/solution/tech-solution/hologres-olap), which involves the creation and deployment of resources such as Virtual Private Cloud (VPC), Virtual Switch (VSwitch), Hologres (Interactive Analytics).
8+
<!-- DOCS_DESCRIPTION_EN -->
9+
10+
<!-- BEGIN_TF_DOCS -->
11+
## Providers
12+
13+
| Name | Version |
14+
|------|---------|
15+
| <a name="provider_alicloud"></a> [alicloud](#provider\_alicloud) | n/a |
16+
| <a name="provider_random"></a> [random](#provider\_random) | n/a |
17+
18+
## Modules
19+
20+
No modules.
21+
22+
## Resources
23+
24+
| Name | Type |
25+
|------|------|
26+
| [alicloud_hologram_instance.hologram](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/hologram_instance) | resource |
27+
| [alicloud_vpc.vpc](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/vpc) | resource |
28+
| [alicloud_vswitch.vswitch](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/vswitch) | resource |
29+
| [random_id.suffix](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) | resource |
30+
31+
## Inputs
32+
33+
| Name | Description | Type | Default | Required |
34+
|------|-------------|------|---------|:--------:|
35+
| <a name="input_zone_id"></a> [zone\_id](#input\_zone\_id) | 选择可用区 | `string` | `"cn-hangzhou-j"` | no |
36+
<!-- END_TF_DOCS -->
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# ------------------------------------------------------------------------------
2+
# 核心资源定义
3+
#
4+
# 本文件包含了模块的核心基础设施资源
5+
# 这里的代码负责根据输入变量来创建和配置所有云资源
6+
# ------------------------------------------------------------------------------
7+
8+
# 配置阿里云提供商
9+
provider "alicloud" {
10+
region = "cn-hangzhou"
11+
}
12+
13+
# 创建一个随机ID
14+
resource "random_id" "suffix" {
15+
byte_length = 8
16+
}
17+
18+
# 定义本地变量
19+
locals {
20+
common_name = "olap-analysis-${random_id.suffix.id}"
21+
}
22+
23+
# 创建专有网络VPC
24+
resource "alicloud_vpc" "vpc" {
25+
cidr_block = "192.168.0.0/16"
26+
vpc_name = "${local.common_name}-vpc"
27+
}
28+
29+
# 创建交换机VSwitch
30+
resource "alicloud_vswitch" "vswitch" {
31+
vpc_id = alicloud_vpc.vpc.id
32+
cidr_block = "192.168.0.0/24"
33+
zone_id = var.zone_id
34+
vswitch_name = "${local.common_name}-vsw"
35+
}
36+
37+
# 创建Hologram实例
38+
resource "alicloud_hologram_instance" "hologram" {
39+
instance_type = "Standard"
40+
zone_id = var.zone_id
41+
payment_type = "PayAsYouGo"
42+
pricing_cycle = "Hour"
43+
cpu = 32
44+
instance_name = "${local.common_name}-hologram"
45+
46+
# 配置内网端点
47+
endpoints {
48+
type = "Intranet"
49+
}
50+
51+
# 配置VPC单通道端点
52+
endpoints {
53+
vpc_id = alicloud_vpc.vpc.id
54+
vswitch_id = alicloud_vswitch.vswitch.id
55+
type = "VPCSingleTunnel"
56+
}
57+
# 配置互联网端点
58+
endpoints {
59+
type = "Internet"
60+
}
61+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# ------------------------------------------------------------------------------
2+
# 模块输出值
3+
#
4+
# 本文件定义了模块执行成功后返回给调用方的值。
5+
# 这些输出可以被其他 Terraform 配置引用,或在 apply 命令结束后显示给用户。
6+
# ------------------------------------------------------------------------------
7+
8+
# 输出 Hologram 实例 ID
9+
output "hologram_instance_id" {
10+
value = alicloud_hologram_instance.hologram.id
11+
description = "Hologram 实例 ID"
12+
}
13+
14+
# 输出专有网络实例 ID
15+
output "vpc_instance_id" {
16+
value = alicloud_vpc.vpc.id
17+
description = "专有网络实例 ID"
18+
}
19+
20+
# 输出交换机实例 ID
21+
output "vswitch_instance_id" {
22+
value = alicloud_vswitch.vswitch.id
23+
description = "交换机实例 ID"
24+
}
25+
26+
# 输出JDBC连接地址
27+
output "jdbcaddress" {
28+
value = "rm-bp1z69dodhh85z9qa.mysql.rds.aliyuncs.com:3306"
29+
description = "JDBC连接地址"
30+
}
31+
32+
# 输出数据库名称
33+
output "data_base_name" {
34+
value = "github_events_share"
35+
description = "数据库名称"
36+
}
37+
38+
# 输出数据库用户名
39+
output "data_base_user_name" {
40+
value = "workshop"
41+
description = "数据库用户名"
42+
}
43+
44+
# 输出数据库密码
45+
output "data_base_password" {
46+
value = "workshop#2017"
47+
description = "数据库密码"
48+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# ------------------------------------------------------------------------------
2+
# 模块输入变量
3+
#
4+
# 本文件定义了该 Terraform 模块所有可配置的输入变量。
5+
# 每个变量都包含了详细的说明,以帮助用户正确配置模块。
6+
# ------------------------------------------------------------------------------
7+
8+
# 指定资源创建的阿里云可用区,默认为cn-hangzhou-j
9+
variable "zone_id" {
10+
type = string
11+
description = "选择可用区"
12+
default = "cn-hangzhou-j"
13+
}

0 commit comments

Comments
 (0)