Skip to content

Commit

Permalink
Merge pull request #2647 from tencentcloudstack/fix/cdb-dr-doc
Browse files Browse the repository at this point in the history
docs(cdb): [117594777]modify dr instance doc
  • Loading branch information
gitmkn authored May 22, 2024
2 parents 6663b59 + d6fdcd2 commit 23b514e
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 130 deletions.
3 changes: 3 additions & 0 deletions .changelog/2647.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
tencentcloud_mysql_dr_instance: modify doc
```
3 changes: 2 additions & 1 deletion .github/workflows/tfprovider-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:

- uses: actions/setup-go@v3
with:
go-version-file: .go-version
go-version: 1.18.1
cache: false

- name: install tfproviderlint
run: cd .ci/tools && go install github.com/bflad/tfproviderlint/cmd/tfproviderlint
Expand Down
89 changes: 25 additions & 64 deletions tencentcloud/services/cdb/resource_tc_mysql_dr_instance.md
Original file line number Diff line number Diff line change
@@ -1,77 +1,38 @@
Provides a mysql instance resource to create read-only database instances.

~> **NOTE:** Read-only instances can be purchased only for two-node or three-node source instances on MySQL 5.6 or above with the InnoDB engine at a specification of 1 GB memory and 50 GB disk capacity or above.
~> **NOTE:** The terminate operation of read only mysql does NOT take effect immediately, maybe takes for several hours. so during that time, VPCs associated with that mysql instance can't be terminated also.

Example Usage

```hcl
data "tencentcloud_availability_zones_by_product" "zones" {
product = "cdb"
}
resource "tencentcloud_vpc" "vpc" {
name = "vpc-mysql"
cidr_block = "10.0.0.0/16"
}
resource "tencentcloud_subnet" "subnet" {
availability_zone = data.tencentcloud_availability_zones_by_product.zones.zones.0.name
name = "subnet-mysql"
vpc_id = tencentcloud_vpc.vpc.id
cidr_block = "10.0.0.0/16"
is_multicast = false
}
resource "tencentcloud_security_group" "security_group" {
name = "sg-mysql"
description = "mysql test"
}
resource "tencentcloud_mysql_instance" "example" {
internet_service = 1
engine_version = "5.7"
charge_type = "POSTPAID"
root_password = "PassWord123"
slave_deploy_mode = 0
availability_zone = data.tencentcloud_availability_zones_by_product.zones.zones.0.name
slave_sync_mode = 1
instance_name = "tf-example-mysql"
mem_size = 4000
volume_size = 200
vpc_id = tencentcloud_vpc.vpc.id
subnet_id = tencentcloud_subnet.subnet.id
intranet_port = 3306
security_groups = [tencentcloud_security_group.security_group.id]
tags = {
name = "test"
}
parameters = {
character_set_server = "UTF8"
max_connections = "1000"
}
}
resource "tencentcloud_mysql_readonly_instance" "example" {
master_instance_id = tencentcloud_mysql_instance.example.id
instance_name = "tf-example"
mem_size = 128000
volume_size = 255
vpc_id = tencentcloud_vpc.vpc.id
subnet_id = tencentcloud_subnet.subnet.id
intranet_port = 3306
security_groups = [tencentcloud_security_group.security_group.id]
resource "tencentcloud_mysql_dr_instance" "mysql_dr" {
master_instance_id = "cdb-adjdu3t5"
master_region = "ap-guangzhou"
auto_renew_flag = 0
availability_zone = "ap-shanghai-3"
charge_type = "POSTPAID"
cpu = 4
device_type = "UNIVERSAL"
first_slave_zone = "ap-shanghai-4"
instance_name = "mysql-dr-test-up"
mem_size = 8000
prepaid_period = 1
project_id = 0
security_groups = [
"sg-q4d821qk",
]
slave_deploy_mode = 1
slave_sync_mode = 0
subnet_id = "subnet-5vfntba5"
volume_size = 100
vpc_id = "vpc-h6s1s3aa"
intranet_port = 3360
tags = {
createBy = "terraform"
test = "test-tf"
}
}
```
Import

mysql read-only database instances can be imported using the id, e.g.
mysql dr database instances can be imported using the id, e.g.
```
terraform import tencentcloud_mysql_readonly_instance.default cdb-dnqksd9f
terraform import tencentcloud_mysql_dr_instance.mysql_dr cdb-bcet7sdb
```
2 changes: 1 addition & 1 deletion website/docs/d/gaap_real_servers_status.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Use this data source to query detailed information of gaap real servers status

```hcl
data "tencentcloud_gaap_real_servers_status" "real_servers_status" {
real_server_ids = ["rs-qcygnwpd"]
real_server_ids = ["rs-3mlpbuut"]
}
```

Expand Down
89 changes: 25 additions & 64 deletions website/docs/r/mysql_dr_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -11,72 +11,33 @@ description: |-

Provides a mysql instance resource to create read-only database instances.

~> **NOTE:** Read-only instances can be purchased only for two-node or three-node source instances on MySQL 5.6 or above with the InnoDB engine at a specification of 1 GB memory and 50 GB disk capacity or above.
~> **NOTE:** The terminate operation of read only mysql does NOT take effect immediately, maybe takes for several hours. so during that time, VPCs associated with that mysql instance can't be terminated also.

## Example Usage

```hcl
data "tencentcloud_availability_zones_by_product" "zones" {
product = "cdb"
}
resource "tencentcloud_vpc" "vpc" {
name = "vpc-mysql"
cidr_block = "10.0.0.0/16"
}
resource "tencentcloud_subnet" "subnet" {
availability_zone = data.tencentcloud_availability_zones_by_product.zones.zones.0.name
name = "subnet-mysql"
vpc_id = tencentcloud_vpc.vpc.id
cidr_block = "10.0.0.0/16"
is_multicast = false
}
resource "tencentcloud_security_group" "security_group" {
name = "sg-mysql"
description = "mysql test"
}
resource "tencentcloud_mysql_instance" "example" {
internet_service = 1
engine_version = "5.7"
charge_type = "POSTPAID"
root_password = "PassWord123"
slave_deploy_mode = 0
availability_zone = data.tencentcloud_availability_zones_by_product.zones.zones.0.name
slave_sync_mode = 1
instance_name = "tf-example-mysql"
mem_size = 4000
volume_size = 200
vpc_id = tencentcloud_vpc.vpc.id
subnet_id = tencentcloud_subnet.subnet.id
intranet_port = 3306
security_groups = [tencentcloud_security_group.security_group.id]
tags = {
name = "test"
}
parameters = {
character_set_server = "UTF8"
max_connections = "1000"
}
}
resource "tencentcloud_mysql_readonly_instance" "example" {
master_instance_id = tencentcloud_mysql_instance.example.id
instance_name = "tf-example"
mem_size = 128000
volume_size = 255
vpc_id = tencentcloud_vpc.vpc.id
subnet_id = tencentcloud_subnet.subnet.id
intranet_port = 3306
security_groups = [tencentcloud_security_group.security_group.id]
resource "tencentcloud_mysql_dr_instance" "mysql_dr" {
master_instance_id = "cdb-adjdu3t5"
master_region = "ap-guangzhou"
auto_renew_flag = 0
availability_zone = "ap-shanghai-3"
charge_type = "POSTPAID"
cpu = 4
device_type = "UNIVERSAL"
first_slave_zone = "ap-shanghai-4"
instance_name = "mysql-dr-test-up"
mem_size = 8000
prepaid_period = 1
project_id = 0
security_groups = [
"sg-q4d821qk",
]
slave_deploy_mode = 1
slave_sync_mode = 0
subnet_id = "subnet-5vfntba5"
volume_size = 100
vpc_id = "vpc-h6s1s3aa"
intranet_port = 3360
tags = {
createBy = "terraform"
test = "test-tf"
}
}
```
Expand Down Expand Up @@ -120,8 +81,8 @@ In addition to all arguments above, the following attributes are exported:

## Import

mysql read-only database instances can be imported using the id, e.g.
mysql dr database instances can be imported using the id, e.g.
```
terraform import tencentcloud_mysql_readonly_instance.default cdb-dnqksd9f
terraform import tencentcloud_mysql_dr_instance.mysql_dr cdb-bcet7sdb
```

0 comments on commit 23b514e

Please sign in to comment.