Skip to content

Commit

Permalink
Merge pull request #127 from volcengine/feat/redis
Browse files Browse the repository at this point in the history
Feat/redis
  • Loading branch information
zpp12354321 authored Sep 13, 2023
2 parents 8c79787 + e14271d commit 54167c2
Show file tree
Hide file tree
Showing 66 changed files with 3,281 additions and 234 deletions.
4 changes: 4 additions & 0 deletions common/common_volcengine_limit.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ func init() {
Limiter: rate.NewLimiter(4, 10),
Semaphore: semaphore.NewWeighted(10),
},
"vpc.DescribeSecurityGroups.2020-04-01": {
Limiter: rate.NewLimiter(4, 10),
Semaphore: semaphore.NewWeighted(10),
},
}
}

Expand Down
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.108"
TerraformProviderVersion = "0.0.109"
)
57 changes: 54 additions & 3 deletions example/dataESCloudInstances/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,55 @@
data "volcengine_escloud_instances" "default"{
ids = ["d3gftqjvnah74eie"]
statuses = ["Running"]
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_new"
description = "tfdesc"
cidr_block = "172.16.0.0/24"
zone_id = data.volcengine_zones.foo.zones[0].id
vpc_id = volcengine_vpc.foo.id
}

resource "volcengine_escloud_instance" "foo" {
instance_configuration {
version = "V6_7"
zone_number = 1
enable_https = true
admin_user_name = "admin"
admin_password = "Password@@"
charge_type = "PostPaid"
configuration_code = "es.standard"
enable_pure_master = true
instance_name = "acc-test-0"
node_specs_assigns {
type = "Master"
number = 3
resource_spec_name = "es.x4.medium"
storage_spec_name = "es.volume.essd.pl0"
storage_size = 100
}
node_specs_assigns {
type = "Hot"
number = 2
resource_spec_name = "es.x4.large"
storage_spec_name = "es.volume.essd.pl0"
storage_size = 100
}
node_specs_assigns {
type = "Kibana"
number = 1
resource_spec_name = "kibana.x2.small"
}
subnet_id = volcengine_subnet.foo.id
project_name = "default"
force_restart_after_scale = false
}
}

data "volcengine_escloud_instances" "foo"{
ids = [volcengine_escloud_instance.foo.id]
}
44 changes: 42 additions & 2 deletions example/dataRedisAccounts/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
data "volcengine_redis_accounts" "default" {
instance_id = "redis-cn0398aizj8cwmopx"
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_redis_instance" "foo"{
zone_ids = [data.volcengine_zones.foo.zones[0].id]
instance_name = "acc-test-tf-redis"
sharded_cluster = 1
password = "1qaz!QAZ12"
node_number = 2
shard_capacity = 1024
shard_number = 2
engine_version = "5.0"
subnet_id = volcengine_subnet.foo.id
deletion_protection = "disabled"
vpc_auth_mode = "close"
charge_type = "PostPaid"
port = 6381
project_name = "default"
}

resource "volcengine_redis_account" "foo" {
account_name = "acc_test_account"
instance_id = volcengine_redis_instance.foo.id
password = "Password@@"
role_name = "ReadOnly"
}

data "volcengine_redis_accounts" "foo"{
account_name = volcengine_redis_account.foo.account_name
instance_id = volcengine_redis_instance.foo.id
}
46 changes: 45 additions & 1 deletion example/dataRedisAllowLists/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
data "volcengine_redis_allow_lists" "default" {
resource "volcengine_redis_allow_list" "foo" {
allow_list = ["192.168.0.0/24"]
allow_list_name = "acc-test-allowlist"
}

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_redis_instance" "foo"{
zone_ids = [data.volcengine_zones.foo.zones[0].id]
instance_name = "acc-test-tf-redis"
sharded_cluster = 1
password = "1qaz!QAZ12"
node_number = 2
shard_capacity = 1024
shard_number = 2
engine_version = "5.0"
subnet_id = volcengine_subnet.foo.id
deletion_protection = "disabled"
vpc_auth_mode = "close"
charge_type = "PostPaid"
port = 6381
project_name = "default"
}

resource "volcengine_redis_allow_list_associate" "foo" {
allow_list_id = volcengine_redis_allow_list.foo.id
instance_id = volcengine_redis_instance.foo.id
}

data "volcengine_redis_allow_lists" "foo"{
instance_id = volcengine_redis_allow_list_associate.foo.instance_id
region_id = "cn-beijing"
name_regex = volcengine_redis_allow_list.foo.allow_list_name
}
44 changes: 40 additions & 4 deletions example/dataRedisBackups/main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
data "volcengine_redis_backups" "default" {
instance_id = "redis-cnlfvrv4qye6u4lpa"
backup_strategy_list = ["ManualBackup"]
}
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_redis_instance" "foo"{
zone_ids = ["${data.volcengine_zones.foo.zones[0].id}"]
instance_name = "acc-test-tf-redis"
sharded_cluster = 1
password = "1qaz!QAZ12"
node_number = 2
shard_capacity = 1024
shard_number = 2
engine_version = "5.0"
subnet_id = "${volcengine_subnet.foo.id}"
deletion_protection = "disabled"
vpc_auth_mode = "close"
charge_type = "PostPaid"
port = 6381
project_name = "default"
}

resource "volcengine_redis_backup" "foo" {
instance_id = "${volcengine_redis_instance.foo.id}"
count = 3
}

data "volcengine_redis_backups" "foo"{
instance_id = "${volcengine_redis_instance.foo.id}"
}
36 changes: 34 additions & 2 deletions example/dataRedisInstances/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
data "volcengine_redis_instances" "default"{
instance_id = "redis-cnlf2lh1kksvv****"
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_redis_instance" "foo" {
zone_ids = [data.volcengine_zones.foo.zones[0].id]
instance_name = "acc-test-tf-redis"
sharded_cluster = 1
password = "1qaz!QAZ12"
node_number = 2
shard_capacity = 1024
shard_number = 2
engine_version = "5.0"
subnet_id = volcengine_subnet.foo.id
deletion_protection = "disabled"
vpc_auth_mode = "close"
charge_type = "PostPaid"
port = 6381
project_name = "default"
}

data "volcengine_redis_instances" "foo" {
instance_id = volcengine_redis_instance.foo.id
}
3 changes: 3 additions & 0 deletions example/dataRegions/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "volcengine_regions" "default" {
ids = ["cn-beijing"]
}
2 changes: 1 addition & 1 deletion example/dataTlsIndexes/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
data "volcengine_tls_indexes" "default" {
ids = ["65d67d34-c5b4-4ec8-b3a9-175d3366****"]
ids = ["7ce12237-6670-44a7-9d79-2e36961586e6"]
}
23 changes: 19 additions & 4 deletions example/esCloudInstance/main.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
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_new"
description = "tfdesc"
cidr_block = "172.16.0.0/24"
zone_id = data.volcengine_zones.foo.zones[0].id
vpc_id = volcengine_vpc.foo.id
}

resource "volcengine_escloud_instance" "foo" {
instance_configuration {
version = "V6_7"
zone_number = 1
enable_https = true
admin_user_name = "admin"
admin_password = "xxxx"
admin_password = "Password@@"
charge_type = "PostPaid"
configuration_code = "es.standard"
enable_pure_master = true
instance_name = "from-tf4"
instance_name = "acc-test-0"
node_specs_assigns {
type = "Master"
number = 3
Expand All @@ -28,9 +44,8 @@ resource "volcengine_escloud_instance" "foo" {
number = 1
resource_spec_name = "kibana.x2.small"
}
subnet_id = "subnet-2bz9vxrixqigw2dx0eextz50p"
subnet_id = volcengine_subnet.foo.id
project_name = "default"
force_restart_after_scale = false
project_name = "default"
}
}
39 changes: 35 additions & 4 deletions example/redisAccount/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,38 @@
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_redis_instance" "foo"{
zone_ids = [data.volcengine_zones.foo.zones[0].id]
instance_name = "acc-test-tf-redis"
sharded_cluster = 1
password = "1qaz!QAZ12"
node_number = 2
shard_capacity = 1024
shard_number = 2
engine_version = "5.0"
subnet_id = volcengine_subnet.foo.id
deletion_protection = "disabled"
vpc_auth_mode = "close"
charge_type = "PostPaid"
port = 6381
project_name = "default"
}

resource "volcengine_redis_account" "foo" {
instance_id = "redis-cn0398aizj8cwmopx"
account_name = "test"
password = "1qaz!QAZ"
account_name = "acc_test_account"
instance_id = volcengine_redis_instance.foo.id
password = "Password@@"
role_name = "ReadOnly"
description = "test12345"
}
4 changes: 2 additions & 2 deletions example/redisAllowList/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "volcengine_redis_allow_list" "foo" {
allow_list_name = "rx_test_tf_allowlist_create"
allow_list_name = "acc_test_tf_allowlist_create"
allow_list = ["0.0.0.0/0", "192.168.0.0/24", "192.168.1.1", "192.168.2.22"]
allow_list_desc = "renxin terraform测试白xxxxxxx"
allow_list_desc = "acctftestallowlist"
}
Loading

0 comments on commit 54167c2

Please sign in to comment.