Skip to content

Commit f977ab1

Browse files
author
alibaba
committed
first commit
0 parents  commit f977ab1

File tree

15 files changed

+1050
-0
lines changed

15 files changed

+1050
-0
lines changed

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# used for testing
2+
*.tfvars
3+
4+
# Compiled files
5+
*.tfstate
6+
*.tfstate.backup
7+
8+
# Module directory
9+
.terraform/
10+
11+
# terraform log
12+
*.log
13+
14+
# auto-generated key pair file
15+
*.pem
16+
17+
# tools files
18+
.DS_Store
19+
.idea
20+
21+
# others
22+
*.bak
23+
*.bk
24+
25+
.terraform.lock.hcl
26+
.terraform.tfstate.lock.info

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 1.0.0 (2021-09-07)
2+
3+
- Project initialization.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#The MIT License (MIT)
2+
3+
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README-CN.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
Terraform module which creates Migration service with RDS&GPDB on Alibaba Cloud
2+
3+
terraform-alicloud-rds-to-gpdb
4+
=====================================================================
5+
6+
[English](README.md) | 简体中文
7+
8+
本 Module 用于在阿里云的 VPC 下创建一个数据迁移服务。
9+
10+
本 Module 支持创建以下资源:
11+
12+
* [alicloud_instance](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/instance)
13+
* [alicloud_gpdb_instance](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/gpdb_instance)
14+
* [alicloud_slb_load_balancer](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/slb_load_balancer)
15+
* [alicloud_eip](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/eip)
16+
* [alicloud_vpc](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/vpc)
17+
* [alicloud_vswitch](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/vswitch)
18+
* [alicloud_security_group](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/security_group)
19+
* [alicloud_db_instance](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/db_instance)
20+
21+
## 用法
22+
23+
```hcl
24+
module "example" {
25+
source = "terraform-alicloud-modules/rds-to-gpdb/alicloud"
26+
name = "tf-rds-to-gpdb"
27+
ecs_instance_type = "ecs.n4.large"
28+
rds_instance_type = "rds.mysql.s3.large"
29+
gpdb_instance_class = "gpdb.group.segsdx2"
30+
}
31+
```
32+
33+
## 注意事项
34+
35+
* 本 Module 使用的 AccessKey 和 SecretKey 可以直接从 `profile``shared_credentials_file`
36+
中获取。如果未设置,可通过下载安装 [aliyun-cli](https://github.com/aliyun/aliyun-cli#installation) 后进行配置。
37+
38+
## 要求
39+
40+
| Name | Version |
41+
|------|---------|
42+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | > = 0.13.0 |
43+
| <a name="requirement_alicloud"></a> [alicloud](#requirement\_alicloud) | > = 1.127.0 |
44+
45+
## Providers
46+
47+
| Name | Version |
48+
|------|---------|
49+
| <a name="provider_alicloud"></a> [alicloud](#provider\_alicloud) | > = 1.127.0 |
50+
51+
## 提交问题
52+
53+
如果在使用该 Terraform Module
54+
的过程中有任何问题,可以直接创建一个 [Provider Issue](https://github.com/aliyun/terraform-provider-alicloud/issues/new),我们将根据问题描述提供解决方案。
55+
56+
**注意:** 不建议在该 Module 仓库中直接提交 Issue。
57+
58+
## 作者
59+
60+
Created and maintained by Will(ppnjy@qq.com)
61+
62+
## 许可
63+
64+
MIT Licensed. See LICENSE for full details.
65+
66+
## 参考
67+
68+
* [Terraform-Provider-Alicloud Github](https://github.com/aliyun/terraform-provider-alicloud)
69+
* [Terraform-Provider-Alicloud Release](https://releases.hashicorp.com/terraform-provider-alicloud/)
70+
* [Terraform-Provider-Alicloud Docs](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs)

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
Terraform module which creates Migration service with RDS&GPDB on Alibaba Cloud
2+
3+
terraform-alicloud-rds-to-gpdb
4+
=====================================================================
5+
6+
English | [简体中文](README-CN.md)
7+
8+
This module is used to create a data migration service under Alibaba Cloud.
9+
10+
These types of resources are supported:
11+
12+
* [alicloud_instance](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/instance)
13+
* [alicloud_gpdb_instance](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/gpdb_instance)
14+
* [alicloud_slb_load_balancer](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/slb_load_balancer)
15+
* [alicloud_eip](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/eip)
16+
* [alicloud_vpc](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/vpc)
17+
* [alicloud_vswitch](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/vswitch)
18+
* [alicloud_security_group](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/security_group)
19+
* [alicloud_db_instance](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/db_instance)
20+
21+
## Usage
22+
23+
```hcl
24+
module "example" {
25+
source = "terraform-alicloud-modules/rds-to-gpdb/alicloud"
26+
name = "tf-rds-to-gpdb"
27+
ecs_instance_type = "ecs.n4.large"
28+
rds_instance_type = "rds.mysql.s3.large"
29+
gpdb_instance_class = "gpdb.group.segsdx2"
30+
}
31+
```
32+
33+
## Notes
34+
35+
* This module using AccessKey and SecretKey are from `profile` and `shared_credentials_file`. If you have not set them
36+
yet, please install [aliyun-cli](https://github.com/aliyun/aliyun-cli#installation) and configure it.
37+
38+
## Requirements
39+
40+
| Name | Version |
41+
|------|---------|
42+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | > = 0.13.0 |
43+
| <a name="requirement_alicloud"></a> [alicloud](#requirement\_alicloud) | > = 1.127.0 |
44+
45+
## Providers
46+
47+
| Name | Version |
48+
|------|---------|
49+
| <a name="provider_alicloud"></a> [alicloud](#provider\_alicloud) | > = 1.127.0 |
50+
51+
## Submit Issues
52+
53+
If you have any problems when using this module, please opening
54+
a [provider issue](https://github.com/aliyun/terraform-provider-alicloud/issues/new) and let us know.
55+
56+
**Note:** There does not recommend opening an issue on this repo.
57+
58+
## Authors
59+
60+
Created and maintained by Will(ppnjy@qq.com)
61+
62+
## License
63+
64+
MIT Licensed. See LICENSE for full details.
65+
66+
## Reference
67+
68+
* [Terraform-Provider-Alicloud Github](https://github.com/aliyun/terraform-provider-alicloud)
69+
* [Terraform-Provider-Alicloud Release](https://releases.hashicorp.com/terraform-provider-alicloud/)
70+
* [Terraform-Provider-Alicloud Docs](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs)

example/main.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
variable "name" {
2+
default = "terraform_test"
3+
}
4+
5+
data "alicloud_zones" "default" {
6+
available_resource_creation = "Gpdb"
7+
enable_details = true
8+
}
9+
10+
module "example" {
11+
source = "../"
12+
name = var.name
13+
availability_zone = data.alicloud_zones.default.zones.0.id
14+
}

example/outputs.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
output "this_gpdb_elastic_id" {
2+
value = module.example.this_gpdb_elastic_id
3+
}
4+
5+
output "this_db_id" {
6+
value = module.example.this_db_id
7+
}
8+
9+
output "this_db_name" {
10+
value = module.example.this_db_name
11+
}

main.tf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
resource "alicloud_vpc" "default" {
2+
vpc_name = var.name
3+
cidr_block = var.vpc_cidr_block
4+
}
5+
6+
resource "alicloud_vswitch" "default" {
7+
vswitch_name = var.name
8+
cidr_block = var.vs_cidr_block
9+
vpc_id = alicloud_vpc.default.id
10+
zone_id = var.availability_zone
11+
}
12+
13+
resource "alicloud_gpdb_elastic_instance" "default" {
14+
engine = "gpdb"
15+
engine_version = var.gpdb_engine_version
16+
seg_storage_type = var.seg_storage_type
17+
seg_node_num = var.seg_node_num
18+
storage_size = var.storage_size
19+
instance_spec = var.instance_spec
20+
db_instance_description = var.description
21+
instance_network_type = "VPC"
22+
payment_type = var.payment_type
23+
vswitch_id = alicloud_vswitch.default.id
24+
}
25+
26+
resource "alicloud_db_instance" "default" {
27+
instance_name = var.name
28+
vswitch_id = alicloud_vswitch.default.id
29+
engine = var.engine
30+
engine_version = var.engine_version
31+
instance_type = var.rds_instance_type
32+
instance_storage = var.instance_storage
33+
instance_charge_type = var.instance_charge_type
34+
monitoring_period = var.monitoring_period
35+
}

outputs.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
output "this_gpdb_elastic_id" {
2+
value = alicloud_gpdb_elastic_instance.default.id
3+
}
4+
5+
output "this_db_id" {
6+
value = alicloud_db_instance.default.id
7+
}
8+
9+
output "this_db_name" {
10+
value = alicloud_db_instance.default.instance_name
11+
}

terratest/Gopkg.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[[constraint]]
2+
name = "github.com/gruntwork-io/terratest"
3+
version = "0.17.4"

0 commit comments

Comments
 (0)