-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from volcengine/for_rds_v1
For rds v1
- Loading branch information
Showing
64 changed files
with
5,257 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
data "volcengine_rds_accounts" "default" { | ||
instance_id = "mysql-0fdd3bab2e7c" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
data "volcengine_rds_databases" "default" { | ||
instance_id = "mysql-0fdd3bab2e7c" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
data "volcengine_rds_instances" "default" { | ||
instance_id = "mysql-0fdd3bab2e7c" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
data "volcengine_rds_instances_v2" "default" { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
data "volcengine_rds_ip_lists" "default" { | ||
instance_id = "mysql-0fdd3bab2e7c" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
data "volcengine_rds_parameter_templates" "default" { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
resource "volcengine_rds_account" "foo" { | ||
instance_id = "mysql-0fdd3bab2e7c" | ||
account_name = "test" | ||
account_password = "Aatest123" | ||
account_type = "Normal" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
resource "volcengine_rds_account" "app_name" { | ||
instance_id = "mysql-0fdd3bab2e7c" | ||
account_name = "terraform-test-app" | ||
account_password = "Aatest123" | ||
account_type = "Normal" | ||
} | ||
|
||
resource "volcengine_rds_account_privilege" "foo" { | ||
instance_id = "mysql-0fdd3bab2e7c" | ||
account_name = volcengine_rds_account.app_name.account_name | ||
|
||
db_privileges { | ||
db_name = "foo" | ||
account_privilege = "Custom" | ||
account_privilege_str = "ALTER,ALTER ROUTINE,CREATE,CREATE ROUTINE,CREATE TEMPORARY TABLES" | ||
} | ||
|
||
db_privileges { | ||
db_name = "bar" | ||
account_privilege = "DDLOnly" | ||
} | ||
|
||
db_privileges { | ||
db_name = "demo" | ||
account_privilege = "ReadWrite" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
resource "volcengine_rds_database" "foo" { | ||
instance_id = "mysql-0fdd3bab2e7c" | ||
db_name = "foo" | ||
character_set_name = "utf8mb4" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
resource "volcengine_rds_instance" "foo" { | ||
region = "cn-north-4" | ||
zone = "cn-langfang-b" | ||
instance_name = "tf-test" | ||
db_engine = "MySQL" | ||
db_engine_version = "MySQL_Community_5_7" | ||
vpc_id = "vpc-3cj17x7u9bzeo6c6rrtzfpaeb" | ||
instance_type = "HA" | ||
charge_type = "PostPaid" | ||
storage_type = "LocalSSD" | ||
storage_space_gb = 100 | ||
instance_spec_name = "rds.mysql.1c2g" | ||
subnet_id = "subnet-1g0d4fkh1nabk8ibuxx1jtvss" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
resource "volcengine_rds_instance_v2" "foo" { | ||
db_engine_version = "MySQL_5_7" | ||
instance_type = "HA" | ||
node_info { | ||
node_type = "Primary" | ||
node_spec = "rds.mysql.2c4g" | ||
zone_id = "cn-guilin-a" | ||
} | ||
node_info { | ||
node_type = "Secondary" | ||
node_spec = "rds.mysql.2c4g" | ||
zone_id = "cn-guilin-a" | ||
} | ||
node_info { | ||
node_type = "ReadOnly" | ||
node_spec = "rds.mysql.1c2g" | ||
zone_id = "cn-guilin-a" | ||
} | ||
storage_type = "LocalSSD" | ||
storage_space = 100 | ||
vpc_id = "vpc-2d6ym9l9mqlfk58ozfd64sej3" | ||
subnet_id = "subnet-2d6yma8y0394w58ozfemu5vmi" | ||
instance_name = "tf-test-v2" | ||
lower_case_table_names = "1" | ||
charge_info { | ||
charge_type = "PostPaid" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
resource "volcengine_rds_ip_list" "foo" { | ||
instance_id = "mysql-0fdd3bab2e7c" | ||
group_name = "foo" | ||
ip_list = ["1.1.1.1", "2.2.2.2"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
resource "volcengine_rds_parameter_template" "foo" { | ||
template_desc = "created by terraform" | ||
template_name = "tf-template" | ||
template_type = "MySQL" | ||
template_type_version = "MySQL_Community_5_7" | ||
template_params { | ||
name = "auto_increment_increment" | ||
running_value = "2" | ||
} | ||
template_params { | ||
name = "slow_query_log" | ||
running_value = "ON" | ||
} | ||
template_params { | ||
name = "net_retry_count" | ||
running_value = "33" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
volcengine/rds/rds_account/common_volcengine_rds_account.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package rds_account | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema" | ||
) | ||
|
||
var rdsAccountImporter = func(data *schema.ResourceData, i interface{}) ([]*schema.ResourceData, error) { | ||
items := strings.Split(data.Id(), ":") | ||
if len(items) != 2 { | ||
return []*schema.ResourceData{data}, fmt.Errorf("import id must split with ':'") | ||
} | ||
if err := data.Set("instance_id", items[0]); err != nil { | ||
return []*schema.ResourceData{data}, err | ||
} | ||
if err := data.Set("account_name", items[1]); err != nil { | ||
return []*schema.ResourceData{data}, err | ||
} | ||
return []*schema.ResourceData{data}, nil | ||
} |
Oops, something went wrong.