Skip to content

Commit 02f795e

Browse files
committed
init the module
1 parent 67c690b commit 02f795e

27 files changed

+2029
-0
lines changed

README-CN.md

Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
Terraform module to build hybrid cloud/multi-cloud network for Alibaba Cloud
2+
3+
terraform-alicloud-hybrid-cloud-network
4+
======================================
5+
6+
[English](https://github.com/alibabacloud-automation/terraform-alicloud-hybrid-cloud-network/blob/main/README.md) | 简体中文
7+
8+
本 Module 用于在云上云下业务协同或者多云协同场景时,如何实现通过物理专线和阿里云云网络产品实现云上云下或多云间的业务协同,快速构建安全、稳定、弹性的混合云/多云协同网络,以满足客户的云化进程。
9+
10+
操作流程简介如下:
11+
1. 通过物理专线实现IDC/三方云厂商与阿里云专线接入点的连接;
12+
2. 基于专线实例按需创建边界路由器VBR,不同的VBR间逻辑隔离;
13+
3. 高速通道VBR与云上VPC通过转发路由器TR实现互联互通,您可以将云上多地域的VPC与分布在多地的IDC或三方云资源实现安全、稳定的互联互通。
14+
4. 完成VPC、VSW、VBR、TR等实例的配置,完成网络打通。
15+
16+
架构图:
17+
18+
![image](https://raw.githubusercontent.com/alibabacloud-automation/terraform-alicloud-hybrid-cloud-network/main/scripts/diagram.png)
19+
20+
## 用法
21+
22+
在同一个地域创建 VPC、VBR 资源
23+
24+
```hcl
25+
data "alicloud_express_connect_physical_connections" "example" {
26+
name_regex = "^preserved-NODELETING"
27+
}
28+
29+
module "this" {
30+
source = "alibabacloud-automation/hybrid-cloud-network/alicloud"
31+
32+
vbr_config = [
33+
{
34+
vbr = {
35+
physical_connection_id = data.alicloud_express_connect_physical_connections.example.connections[0].id
36+
vlan_id = 104
37+
local_gateway_ip = "192.168.0.1"
38+
peer_gateway_ip = "192.168.0.2"
39+
peering_subnet_mask = "255.255.255.252"
40+
},
41+
vbr_bgp_group = {
42+
peer_asn = 45000
43+
},
44+
},
45+
]
46+
47+
vpc_config = [
48+
{
49+
vpc = {
50+
cidr_block = "10.0.0.0/16"
51+
},
52+
vswitches = [
53+
{
54+
zone_id = "cn-beijing-i"
55+
cidr_block = "10.0.1.0/24"
56+
},
57+
{
58+
zone_id = "cn-beijing-j"
59+
cidr_block = "10.0.2.0/24"
60+
}
61+
],
62+
},
63+
]
64+
}
65+
```
66+
67+
在杭州地域创建 VBR 资源,在北京区域创建 VPC、 VSwitch 资源
68+
69+
```hcl
70+
provider "alicloud" {
71+
region = "cn-hangzhou"
72+
alias = "hz"
73+
}
74+
75+
data "alicloud_express_connect_physical_connections" "example" {
76+
provider = alicloud.hz
77+
name_regex = "^preserved-NODELETING"
78+
}
79+
80+
module "hz" {
81+
source = "alibabacloud-automation/hybrid-cloud-network/alicloud"
82+
providers = {
83+
alicloud = alicloud.hz
84+
}
85+
86+
vbr_config = [
87+
{
88+
vbr = {
89+
physical_connection_id = data.alicloud_express_connect_physical_connections.example.connections[0].id
90+
vlan_id = 104
91+
local_gateway_ip = "192.168.0.1"
92+
peer_gateway_ip = "192.168.0.2"
93+
peering_subnet_mask = "255.255.255.252"
94+
},
95+
vbr_bgp_group = {
96+
peer_asn = 45000
97+
},
98+
},
99+
]
100+
101+
create_vpc_resources = false
102+
}
103+
104+
provider "alicloud" {
105+
region = "cn-beijing"
106+
alias = "bj"
107+
}
108+
109+
module "bj" {
110+
source = "alibabacloud-automation/hybrid-cloud-network/alicloud"
111+
providers = {
112+
alicloud = alicloud.bj
113+
}
114+
115+
create_cen_instance = false
116+
cen_instance_id = module.hz.cen_instance_id
117+
118+
create_vbr_resources = false
119+
120+
vpc_config = [
121+
{
122+
vpc = {
123+
cidr_block = "10.0.0.0/16"
124+
},
125+
vswitches = [
126+
{
127+
zone_id = "cn-beijing-i"
128+
cidr_block = "10.0.1.0/24"
129+
},
130+
{
131+
zone_id = "cn-beijing-j"
132+
cidr_block = "10.0.2.0/24"
133+
}
134+
],
135+
},
136+
]
137+
}
138+
```
139+
140+
## 示例
141+
142+
* [基础用法](https://github.com/alibabacloud-automation/terraform-alicloud-hybrid-cloud-network/tree/main/examples/basic)
143+
* [完整示例](https://github.com/alibabacloud-automation/terraform-alicloud-hybrid-cloud-network/tree/main/examples/complete)
144+
145+
146+
<!-- BEGIN_TF_DOCS -->
147+
## Requirements
148+
149+
| Name | Version |
150+
|------|---------|
151+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
152+
| <a name="requirement_alicloud"></a> [alicloud](#requirement\_alicloud) | >=1.229.1 |
153+
154+
## Providers
155+
156+
| Name | Version |
157+
|------|---------|
158+
| <a name="provider_alicloud"></a> [alicloud](#provider\_alicloud) | >=1.229.1 |
159+
160+
## Modules
161+
162+
| Name | Source | Version |
163+
|------|--------|---------|
164+
| <a name="module_vbr"></a> [vbr](#module\_vbr) | ./modules/vbr | n/a |
165+
| <a name="module_vpc"></a> [vpc](#module\_vpc) | ./modules/vpc | n/a |
166+
167+
## Resources
168+
169+
| Name | Type |
170+
|------|------|
171+
| [alicloud_cen_instance.this](https://registry.terraform.io/providers/hashicorp/alicloud/latest/docs/resources/cen_instance) | resource |
172+
| [alicloud_cen_transit_router.this](https://registry.terraform.io/providers/hashicorp/alicloud/latest/docs/resources/cen_transit_router) | resource |
173+
174+
## Inputs
175+
176+
| Name | Description | Type | Default | Required |
177+
|------|-------------|------|---------|:--------:|
178+
| <a name="input_cen_instance_config"></a> [cen\_instance\_config](#input\_cen\_instance\_config) | The parameters of cen instance. | <pre>object({<br> cen_instance_name = optional(string, null)<br> protection_level = optional(string, "REDUCED")<br> description = optional(string, null)<br> tags = optional(map(string), {})<br> })</pre> | `{}` | no |
179+
| <a name="input_cen_instance_id"></a> [cen\_instance\_id](#input\_cen\_instance\_id) | The id of an exsiting cen instance. | `string` | `null` | no |
180+
| <a name="input_cen_transit_router_id"></a> [cen\_transit\_router\_id](#input\_cen\_transit\_router\_id) | The transit router id of an existing transit router. | `string` | `null` | no |
181+
| <a name="input_create_cen_instance"></a> [create\_cen\_instance](#input\_create\_cen\_instance) | Whether to create cen instance. If false, you can specify an existing cen instance by setting 'cen\_instance\_id'. Default to 'true' | `bool` | `true` | no |
182+
| <a name="input_create_cen_transit_router"></a> [create\_cen\_transit\_router](#input\_create\_cen\_transit\_router) | Whether to create transit router. If false, you can specify an existing transit router by setting 'cen\_transit\_router\_id'. Default to 'true' | `bool` | `true` | no |
183+
| <a name="input_create_vbr_resources"></a> [create\_vbr\_resources](#input\_create\_vbr\_resources) | Whether to create vbr resources. Default to 'true' | `bool` | `true` | no |
184+
| <a name="input_create_vpc_resources"></a> [create\_vpc\_resources](#input\_create\_vpc\_resources) | Whether to create vpc resources. Default to 'true' | `bool` | `true` | no |
185+
| <a name="input_tr_config"></a> [tr\_config](#input\_tr\_config) | The parameters of transit router. | <pre>object({<br> transit_router_name = optional(string, null)<br> transit_router_description = optional(string, null)<br> support_multicast = optional(string, null)<br> tags = optional(map(string), {})<br> })</pre> | `{}` | no |
186+
| <a name="input_vbr_config"></a> [vbr\_config](#input\_vbr\_config) | The list parameters of vbr resources. The attributes 'vbr', 'vbr\_bgp\_group' are required. | <pre>list(object({<br> vbr = object({<br> physical_connection_id = string<br> vlan_id = number<br> local_gateway_ip = string<br> peer_gateway_ip = string<br> peering_subnet_mask = string<br> virtual_border_router_name = optional(string, null)<br> description = optional(string, null)<br> })<br> tr_vbr_attachment = optional(object({<br> transit_router_attachment_name = optional(string, null)<br> transit_router_attachment_description = optional(string, null)<br> tags = optional(map(string), {})<br> auto_publish_route_enabled = optional(bool, true)<br> route_table_propagation_enabled = optional(bool, true)<br> route_table_association_enabled = optional(bool, true)<br> }), {})<br> vbr_health_check = optional(object({<br> create_vbr_health_check = optional(bool, true)<br> health_check_interval = optional(number, 2)<br> healthy_threshold = optional(number, 8)<br> }), {})<br> vbr_bgp_group = object({<br> peer_asn = string<br> auth_key = optional(string, null)<br> bgp_group_name = optional(string, null)<br> description = optional(string, null)<br> is_fake_asn = optional(bool, false)<br> })<br> vbr_bgp_peer = optional(object({<br> bfd_multi_hop = optional(number, 255)<br> enable_bfd = optional(bool, "false")<br> ip_version = optional(string, "IPV4")<br> peer_ip_address = optional(string, null)<br> }), {})<br> }))</pre> | <pre>[<br> {<br> "vbr": {<br> "local_gateway_ip": null,<br> "peer_gateway_ip": null,<br> "peering_subnet_mask": null,<br> "physical_connection_id": null,<br> "vlan_id": null<br> },<br> "vbr_bgp_group": {<br> "peer_asn": null<br> }<br> }<br>]</pre> | no |
187+
| <a name="input_vpc_config"></a> [vpc\_config](#input\_vpc\_config) | The parameters of vpc resources. The attributes 'vpc', 'vswitches' are required. | <pre>list(object({<br> vpc = map(string)<br> vswitches = list(object({<br> zone_id = string<br> cidr_block = string<br> vswitch_name = optional(string, null)<br> }))<br> tr_vpc_attachment = optional(object({<br> transit_router_attachment_name = optional(string, null)<br> auto_publish_route_enabled = optional(bool, true)<br> route_table_propagation_enabled = optional(bool, true)<br> route_table_association_enabled = optional(bool, true)<br> }), {})<br> }))</pre> | `[]` | no |
188+
189+
## Outputs
190+
191+
| Name | Description |
192+
|------|-------------|
193+
| <a name="output_bgp_group_id"></a> [bgp\_group\_id](#output\_bgp\_group\_id) | The id of BGP group. |
194+
| <a name="output_bgp_group_status"></a> [bgp\_group\_status](#output\_bgp\_group\_status) | The status of BGP group. |
195+
| <a name="output_bgp_peer_id"></a> [bgp\_peer\_id](#output\_bgp\_peer\_id) | The id of BGP peer. |
196+
| <a name="output_bgp_peer_name"></a> [bgp\_peer\_name](#output\_bgp\_peer\_name) | The name of BGP peer. |
197+
| <a name="output_bgp_peer_status"></a> [bgp\_peer\_status](#output\_bgp\_peer\_status) | The status of BGP peer. |
198+
| <a name="output_cen_instance_id"></a> [cen\_instance\_id](#output\_cen\_instance\_id) | The id of CEN instance. |
199+
| <a name="output_cen_instance_status"></a> [cen\_instance\_status](#output\_cen\_instance\_status) | The status of CEN instance. |
200+
| <a name="output_cen_transit_router_id"></a> [cen\_transit\_router\_id](#output\_cen\_transit\_router\_id) | The id of CEN transit router. |
201+
| <a name="output_cen_transit_router_support_multicast"></a> [cen\_transit\_router\_support\_multicast](#output\_cen\_transit\_router\_support\_multicast) | The status of CEN transit router. |
202+
| <a name="output_cen_transit_router_type"></a> [cen\_transit\_router\_type](#output\_cen\_transit\_router\_type) | The type of CEN transit router. |
203+
| <a name="output_health_check_id"></a> [health\_check\_id](#output\_health\_check\_id) | The id of health check. |
204+
| <a name="output_tr_vbr_attachment_id"></a> [tr\_vbr\_attachment\_id](#output\_tr\_vbr\_attachment\_id) | The id of attachment bewteen TR and VBR. |
205+
| <a name="output_tr_vbr_attachment_status"></a> [tr\_vbr\_attachment\_status](#output\_tr\_vbr\_attachment\_status) | The status of attachment bewteen TR and VBR. |
206+
| <a name="output_tr_vbr_route_table_association_id"></a> [tr\_vbr\_route\_table\_association\_id](#output\_tr\_vbr\_route\_table\_association\_id) | The id of route table association bewteen TR and VBR. |
207+
| <a name="output_tr_vbr_route_table_association_status"></a> [tr\_vbr\_route\_table\_association\_status](#output\_tr\_vbr\_route\_table\_association\_status) | The status of route table association bewteen TR and VBR. |
208+
| <a name="output_tr_vbr_route_table_propagation_id"></a> [tr\_vbr\_route\_table\_propagation\_id](#output\_tr\_vbr\_route\_table\_propagation\_id) | The id of route table propagation bewteen TR and VBR. |
209+
| <a name="output_tr_vbr_route_table_propagation_status"></a> [tr\_vbr\_route\_table\_propagation\_status](#output\_tr\_vbr\_route\_table\_propagation\_status) | The status of route table propagation bewteen TR and VBR. |
210+
| <a name="output_tr_vpc_attachment_id"></a> [tr\_vpc\_attachment\_id](#output\_tr\_vpc\_attachment\_id) | The id of attachment between TR and VPC. |
211+
| <a name="output_tr_vpc_attachment_status"></a> [tr\_vpc\_attachment\_status](#output\_tr\_vpc\_attachment\_status) | The status of attachment between TR and VPC. |
212+
| <a name="output_tr_vpc_route_table_association_id"></a> [tr\_vpc\_route\_table\_association\_id](#output\_tr\_vpc\_route\_table\_association\_id) | The id of route table association bewteen TR and VPC. |
213+
| <a name="output_tr_vpc_route_table_association_status"></a> [tr\_vpc\_route\_table\_association\_status](#output\_tr\_vpc\_route\_table\_association\_status) | The status of route table association bewteen TR and VPC. |
214+
| <a name="output_tr_vpc_route_table_propagation_id"></a> [tr\_vpc\_route\_table\_propagation\_id](#output\_tr\_vpc\_route\_table\_propagation\_id) | The id of route table propagation bewteen TR and VPC. |
215+
| <a name="output_tr_vpc_route_table_propagation_status"></a> [tr\_vpc\_route\_table\_propagation\_status](#output\_tr\_vpc\_route\_table\_propagation\_status) | The status of route table propagation bewteen TR and VPC. |
216+
| <a name="output_vbr_id"></a> [vbr\_id](#output\_vbr\_id) | The ids of VBR. |
217+
| <a name="output_vbr_route_table_id"></a> [vbr\_route\_table\_id](#output\_vbr\_route\_table\_id) | The route table id of VBR. |
218+
| <a name="output_vpc_id"></a> [vpc\_id](#output\_vpc\_id) | The ids of vpc. |
219+
| <a name="output_vpc_route_table_id"></a> [vpc\_route\_table\_id](#output\_vpc\_route\_table\_id) | The route table id of vpc. |
220+
| <a name="output_vpc_status"></a> [vpc\_status](#output\_vpc\_status) | The status of vpc. |
221+
| <a name="output_vswitch_ids"></a> [vswitch\_ids](#output\_vswitch\_ids) | The ids of vswitches. |
222+
| <a name="output_vswitch_status"></a> [vswitch\_status](#output\_vswitch\_status) | The status of vswitches. |
223+
<!-- END_TF_DOCS -->
224+
225+
## 提交问题
226+
227+
如果在使用该 Terraform Module 的过程中有任何问题,可以直接创建一个 [Provider Issue](https://github.com/aliyun/terraform-provider-alicloud/issues/new),我们将根据问题描述提供解决方案。
228+
229+
**注意:** 不建议在该 Module 仓库中直接提交 Issue。
230+
231+
## 作者
232+
233+
Created and maintained by Alibaba Cloud Terraform Team([email protected]).
234+
235+
## 许可
236+
237+
MIT Licensed. See LICENSE for full details.
238+
239+
## 参考
240+
241+
* [Terraform-Provider-Alicloud Github](https://github.com/aliyun/terraform-provider-alicloud)
242+
* [Terraform-Provider-Alicloud Release](https://releases.hashicorp.com/terraform-provider-alicloud/)
243+
* [Terraform-Provider-Alicloud Docs](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs)

0 commit comments

Comments
 (0)