-
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 #91 from volcengine/feat/redis
feat: add support for redis
- Loading branch information
Showing
67 changed files
with
5,707 additions
and
3 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
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_redis_accounts" "default" { | ||
instance_id = "redis-cn0398aizj8cwmopx" | ||
} |
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_redis_allow_lists" "default" { | ||
region_id = "cn-beijing" | ||
} |
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,4 @@ | ||
data "volcengine_redis_backups" "default" { | ||
instance_id = "redis-cnlfvrv4qye6u4lpa" | ||
backup_strategy_list = ["ManualBackup"] | ||
} |
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_redis_instances" "default"{ | ||
instance_id = "redis-cnlf2lh1kksvv****" | ||
} |
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_redis_pitr_time_windows" "default" { | ||
ids = ["redis-cnlficlt4974swtbz", "redis-cnlfq69d1y1tnguxz"] | ||
} |
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_redis_regions" "default"{ | ||
region_id="cn-north-3" | ||
} |
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_redis_zones" "default"{ | ||
region_id="cn-north-3" | ||
} |
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,7 @@ | ||
resource "volcengine_redis_account" "foo" { | ||
instance_id = "redis-cn0398aizj8cwmopx" | ||
account_name = "test" | ||
password = "1qaz!QAZ" | ||
role_name = "ReadOnly" | ||
description = "test12345" | ||
} |
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_redis_allow_list" "foo" { | ||
allow_list_name = "rx_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" | ||
} |
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,9 @@ | ||
resource "volcengine_redis_allow_list_associate" "default" { | ||
instance_id = "redis-cnlfbzifs7bpvundz" | ||
allow_list_id = "acl-cnlfc5zsxscu1gg2ajh" | ||
} | ||
|
||
resource "volcengine_redis_allow_list_associate" "default1" { | ||
instance_id = "redis-cnlfbzifs7bpvundz" | ||
allow_list_id = "acl-cnlff2mb31zo85p5am7" | ||
} |
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 @@ | ||
resource "volcengine_redis_backup" "default" { | ||
instance_id = "redis-cnlfvrv4qye6u4lpa" | ||
} |
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,4 @@ | ||
resource "volcengine_redis_backup_restore" "default" { | ||
instance_id = "redis-cnlfvrv4qye6u4lpa" | ||
time_point = "2023-04-14T02:51:51Z" | ||
} |
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 @@ | ||
resource "volcengine_redis_continuous_backup" "foo" { | ||
instance_id = "redis-cnlficlt4974s****" | ||
} |
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,42 @@ | ||
resource "volcengine_redis_instance" "foo"{ | ||
zone_ids = ["cn-beijing-a", "cn-beijing-b"] | ||
instance_name = "tf-test" | ||
sharded_cluster = 1 | ||
password = "1qaz!QAZ12" | ||
node_number = 2 | ||
shard_capacity = 1024 | ||
shard_number = 2 | ||
engine_version = "5.0" | ||
subnet_id = "subnet-13g7c3lot0lc03n6nu4wj****" | ||
deletion_protection = "disabled" | ||
vpc_auth_mode = "close" | ||
charge_type = "PostPaid" | ||
# purchase_months = 1 | ||
# auto_renew = false | ||
port = 6381 | ||
project_name = "default" | ||
tags { | ||
key = "k1" | ||
value = "v1" | ||
} | ||
tags { | ||
key = "k3" | ||
value = "v3" | ||
} | ||
|
||
param_values{ | ||
name = "active-defrag-cycle-min" | ||
value = "5" | ||
} | ||
param_values{ | ||
name = "active-defrag-cycle-max" | ||
value = "28" | ||
} | ||
|
||
backup_period = [1, 2, 3] | ||
backup_hour = 4 | ||
backup_active = true | ||
|
||
create_backup = false | ||
apply_immediately = true | ||
} |
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,4 @@ | ||
resource "volcengine_redis_endpoint" "foo" { | ||
instance_id = "redis-cn03bb67g3tr2****" | ||
eip_id = "eip-274ho3mtx543k7fap8tyi****" | ||
} |
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,4 @@ | ||
resource "volcengine_redis_instance_state" "foo" { | ||
action = "Restart" | ||
instance_id = "redis-cnlficlt4974swtbz" | ||
} |
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
68 changes: 68 additions & 0 deletions
68
volcengine/redis/account/data_source_volcengine_redis_accounts.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,68 @@ | ||
package account | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema" | ||
volc "github.com/volcengine/terraform-provider-volcengine/common" | ||
) | ||
|
||
func DataSourceVolcengineRedisAccounts() *schema.Resource { | ||
return &schema.Resource{ | ||
Read: dataSourceVolcengineRedisAccountsRead, | ||
Schema: map[string]*schema.Schema{ | ||
"output_file": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "File name where to save data source results.", | ||
}, | ||
"total_count": { | ||
Type: schema.TypeInt, | ||
Computed: true, | ||
Description: "The total count of redis accounts query.", | ||
}, | ||
"instance_id": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
Description: "The id of the Redis instance.", | ||
}, | ||
"account_name": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "The name of the redis account.", | ||
}, | ||
"accounts": { | ||
Description: "The collection of redis instance account query.", | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"account_name": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The name of the redis account.", | ||
}, | ||
"instance_id": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The id of instance.", | ||
}, | ||
"role_name": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The role info.", | ||
}, | ||
"description": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The description of the redis account.", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func dataSourceVolcengineRedisAccountsRead(d *schema.ResourceData, meta interface{}) error { | ||
redisAccountService := NewAccountService(meta.(*volc.SdkClient)) | ||
return volc.DefaultDispatcher().Data(redisAccountService, d, DataSourceVolcengineRedisAccounts()) | ||
} |
Oops, something went wrong.