Skip to content

Commit

Permalink
Merge pull request #125 from volcengine/feat/rds
Browse files Browse the repository at this point in the history
Feat/rds
  • Loading branch information
zpp12354321 authored Sep 6, 2023
2 parents edaa813 + 6d28b79 commit 2454d3b
Show file tree
Hide file tree
Showing 36 changed files with 2,153 additions and 111 deletions.
2 changes: 1 addition & 1 deletion common/common_volcengine_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package common

const (
TerraformProviderName = "terraform-provider-volcengine"
TerraformProviderVersion = "0.0.106"
TerraformProviderVersion = "0.0.107"
)
60 changes: 57 additions & 3 deletions example/dataRdsMysqlAccounts/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,58 @@
data "volcengine_rds_mysql_accounts" "default"{
instance_id="mysql-47d6bc58762b"
account_name=""
data "volcengine_zones" "foo"{
}

resource "volcengine_vpc" "foo" {
vpc_name = "acc-test-vpc"
cidr_block = "172.16.0.0/16"
}

resource "volcengine_subnet" "foo" {
subnet_name = "acc-test-subnet"
cidr_block = "172.16.0.0/24"
zone_id = data.volcengine_zones.foo.zones[0].id
vpc_id = volcengine_vpc.foo.id
}

resource "volcengine_rds_mysql_instance" "foo" {
instance_name = "acc-test-rds-mysql"
db_engine_version = "MySQL_5_7"
node_spec = "rds.mysql.1c2g"
primary_zone_id = data.volcengine_zones.foo.zones[0].id
secondary_zone_id = data.volcengine_zones.foo.zones[0].id
storage_space = 80
subnet_id = volcengine_subnet.foo.id
lower_case_table_names = "1"
charge_info {
charge_type = "PostPaid"
}
parameters {
parameter_name = "auto_increment_increment"
parameter_value = "2"
}
parameters {
parameter_name = "auto_increment_offset"
parameter_value = "4"
}
}

resource "volcengine_rds_mysql_database" "foo" {
db_name = "acc-test-db"
instance_id = volcengine_rds_mysql_instance.foo.id
}

resource "volcengine_rds_mysql_account" "foo" {
account_name = "acc-test-account"
account_password = "93f0cb0614Aab12"
account_type = "Normal"
instance_id = volcengine_rds_mysql_instance.foo.id
account_privileges {
db_name = volcengine_rds_mysql_database.foo.db_name
account_privilege = "Custom"
account_privilege_detail = "SELECT,INSERT"
}
}

data "volcengine_rds_mysql_accounts" "foo"{
instance_id = volcengine_rds_mysql_instance.foo.id
account_name = volcengine_rds_mysql_account.foo.account_name
}
52 changes: 50 additions & 2 deletions example/dataRdsMysqlAllowlists/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
data "volcengine_rds_mysql_allowlists" "default" {
region_id = "cn-guilin-boe"
data "volcengine_zones" "foo"{
}

resource "volcengine_vpc" "foo" {
vpc_name = "acc-test-vpc"
cidr_block = "172.16.0.0/16"
}

resource "volcengine_subnet" "foo" {
subnet_name = "acc-test-subnet"
cidr_block = "172.16.0.0/24"
zone_id = data.volcengine_zones.foo.zones[0].id
vpc_id = volcengine_vpc.foo.id
}

resource "volcengine_rds_mysql_allowlist" "foo" {
allow_list_name = "acc-test-allowlist-${count.index}"
allow_list_desc = "acc-test"
allow_list_type = "IPv4"
allow_list = ["192.168.0.0/24", "192.168.1.0/24"]
count = 3
}

resource "volcengine_rds_mysql_instance" "foo" {
instance_name = "acc-test-rds-mysql"
db_engine_version = "MySQL_5_7"
node_spec = "rds.mysql.1c2g"
primary_zone_id = data.volcengine_zones.foo.zones[0].id
secondary_zone_id = data.volcengine_zones.foo.zones[0].id
storage_space = 80
subnet_id = volcengine_subnet.foo.id
lower_case_table_names = "1"
charge_info {
charge_type = "PostPaid"
}
parameters {
parameter_name = "auto_increment_increment"
parameter_value = "2"
}
parameters {
parameter_name = "auto_increment_offset"
parameter_value = "4"
}

allow_list_ids = volcengine_rds_mysql_allowlist.foo[*].id
}

data "volcengine_rds_mysql_allowlists" "foo"{
instance_id = volcengine_rds_mysql_instance.foo.id
region_id = "cn-beijing"
}
49 changes: 46 additions & 3 deletions example/dataRdsMysqlDatabases/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,47 @@
data "volcengine_rds_mysql_databases" "default"{
instance_id=""
db_name=""
data "volcengine_zones" "foo"{
}

resource "volcengine_vpc" "foo" {
vpc_name = "acc-test-project1"
cidr_block = "172.16.0.0/16"
}

resource "volcengine_subnet" "foo" {
subnet_name = "acc-subnet-test-2"
cidr_block = "172.16.0.0/24"
zone_id = data.volcengine_zones.foo.zones[0].id
vpc_id = volcengine_vpc.foo.id
}

resource "volcengine_rds_mysql_instance" "foo" {
db_engine_version = "MySQL_5_7"
node_spec = "rds.mysql.1c2g"
primary_zone_id = data.volcengine_zones.foo.zones[0].id
secondary_zone_id = data.volcengine_zones.foo.zones[0].id
storage_space = 80
subnet_id = volcengine_subnet.foo.id
instance_name = "acc-test"
lower_case_table_names = "1"

charge_info {
charge_type = "PostPaid"
}

parameters {
parameter_name = "auto_increment_increment"
parameter_value = "2"
}
parameters {
parameter_name = "auto_increment_offset"
parameter_value = "4"
}
}

resource "volcengine_rds_mysql_database" "foo" {
db_name = "acc-test"
instance_id = volcengine_rds_mysql_instance.foo.id
}
data "volcengine_rds_mysql_databases" "foo"{
db_name = "acc-test"
instance_id = volcengine_rds_mysql_instance.foo.id
}
43 changes: 41 additions & 2 deletions example/dataRdsMysqlInstances/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,42 @@
data "volcengine_rds_mysql_instances" "default" {
instance_id = "mysql-72da4258c2c7"
data "volcengine_zones" "foo"{
}

resource "volcengine_vpc" "foo" {
vpc_name = "acc-test-project1"
cidr_block = "172.16.0.0/16"
}

resource "volcengine_subnet" "foo" {
subnet_name = "acc-subnet-test-2"
cidr_block = "172.16.0.0/24"
zone_id = data.volcengine_zones.foo.zones[0].id
vpc_id = volcengine_vpc.foo.id
}

resource "volcengine_rds_mysql_instance" "foo" {
db_engine_version = "MySQL_5_7"
node_spec = "rds.mysql.1c2g"
primary_zone_id = data.volcengine_zones.foo.zones[0].id
secondary_zone_id = data.volcengine_zones.foo.zones[0].id
storage_space = 80
subnet_id = volcengine_subnet.foo.id
instance_name = "acc-test"
lower_case_table_names = "1"

charge_info {
charge_type = "PostPaid"
}

parameters {
parameter_name = "auto_increment_increment"
parameter_value = "2"
}
parameters {
parameter_name = "auto_increment_offset"
parameter_value = "4"
}
}

data "volcengine_rds_mysql_instances" "foo"{
instance_id = volcengine_rds_mysql_instance.foo.id
}
67 changes: 52 additions & 15 deletions example/rdsMysqlAccount/main.tf
Original file line number Diff line number Diff line change
@@ -1,16 +1,53 @@
resource "volcengine_rds_mysql_account" "default"{
instance_id="mysql-e9293705eed6"
account_name="test"
account_password="xdjsuiahHUH@"
account_type="Normal"
# account_privileges{
# db_name="tf-test-dbdddddd"
# account_privilege="ReadOnly"
# account_privilege_detail="SELECT,UPDATE,INSERT"
# }
# account_privileges{
# db_name="test-xx"
# account_privilege="ReadOnly"
# account_privilege_detail="SELECT,UPDATE,INSERT"
# }
data "volcengine_zones" "foo"{
}

resource "volcengine_vpc" "foo" {
vpc_name = "acc-test-vpc"
cidr_block = "172.16.0.0/16"
}

resource "volcengine_subnet" "foo" {
subnet_name = "acc-test-subnet"
cidr_block = "172.16.0.0/24"
zone_id = data.volcengine_zones.foo.zones[0].id
vpc_id = volcengine_vpc.foo.id
}

resource "volcengine_rds_mysql_instance" "foo" {
instance_name = "acc-test-rds-mysql"
db_engine_version = "MySQL_5_7"
node_spec = "rds.mysql.1c2g"
primary_zone_id = data.volcengine_zones.foo.zones[0].id
secondary_zone_id = data.volcengine_zones.foo.zones[0].id
storage_space = 80
subnet_id = volcengine_subnet.foo.id
lower_case_table_names = "1"
charge_info {
charge_type = "PostPaid"
}
parameters {
parameter_name = "auto_increment_increment"
parameter_value = "2"
}
parameters {
parameter_name = "auto_increment_offset"
parameter_value = "4"
}
}

resource "volcengine_rds_mysql_database" "foo" {
db_name = "acc-test-db"
instance_id = volcengine_rds_mysql_instance.foo.id
}

resource "volcengine_rds_mysql_account" "foo" {
account_name = "acc-test-account"
account_password = "93f0cb0614Aab12"
account_type = "Normal"
instance_id = volcengine_rds_mysql_instance.foo.id
account_privileges {
db_name = volcengine_rds_mysql_database.foo.db_name
account_privilege = "Custom"
account_privilege_detail = "SELECT,INSERT"
}
}
9 changes: 4 additions & 5 deletions example/rdsMysqlAllowlist/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
resource "volcengine_rds_mysql_allowlist" "foo" {
allow_list_name = "tf-test-opt"
allow_list_desc = "terraform test zzm"
allow_list = [
"127.0.0.1"
]
allow_list_name = "acc-test-allowlist"
allow_list_desc = "acc-test"
allow_list_type = "IPv4"
allow_list = ["192.168.0.0/24", "192.168.1.0/24"]
}
48 changes: 46 additions & 2 deletions example/rdsMysqlAllowlistAssociate/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,48 @@
data "volcengine_zones" "foo"{
}

resource "volcengine_vpc" "foo" {
vpc_name = "acc-test-vpc"
cidr_block = "172.16.0.0/16"
}

resource "volcengine_subnet" "foo" {
subnet_name = "acc-test-subnet"
cidr_block = "172.16.0.0/24"
zone_id = data.volcengine_zones.foo.zones[0].id
vpc_id = volcengine_vpc.foo.id
}

resource "volcengine_rds_mysql_instance" "foo" {
instance_name = "acc-test-rds-mysql"
db_engine_version = "MySQL_5_7"
node_spec = "rds.mysql.1c2g"
primary_zone_id = data.volcengine_zones.foo.zones[0].id
secondary_zone_id = data.volcengine_zones.foo.zones[0].id
storage_space = 80
subnet_id = volcengine_subnet.foo.id
lower_case_table_names = "1"
charge_info {
charge_type = "PostPaid"
}
parameters {
parameter_name = "auto_increment_increment"
parameter_value = "2"
}
parameters {
parameter_name = "auto_increment_offset"
parameter_value = "4"
}
}

resource "volcengine_rds_mysql_allowlist" "foo" {
allow_list_name = "acc-test-allowlist"
allow_list_desc = "acc-test"
allow_list_type = "IPv4"
allow_list = ["192.168.0.0/24", "192.168.1.0/24"]
}

resource "volcengine_rds_mysql_allowlist_associate" "foo" {
instance_id = "mysql-1b2c7b2d7583"
allow_list_id = "acl-15451212dcfa473baeda24be4baa02fe"
allow_list_id = volcengine_rds_mysql_allowlist.foo.id
instance_id = volcengine_rds_mysql_instance.foo.id
}
Loading

0 comments on commit 2454d3b

Please sign in to comment.