-
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 #144 from volcengine/feat/mongo
Feat/mongo
- Loading branch information
Showing
68 changed files
with
2,291 additions
and
169 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 |
---|---|---|
@@ -1,4 +1,11 @@ | ||
data "volcengine_mongodb_allow_lists" "default"{ | ||
region_id = "cn-xxx" | ||
instance_id="mongo-replica-xxx" | ||
resource "volcengine_mongodb_allow_list" "foo" { | ||
allow_list_name="acc-test" | ||
allow_list_desc="acc-test" | ||
allow_list_type="IPv4" | ||
allow_list="10.1.1.3,10.2.3.0/24,10.1.1.1" | ||
} | ||
|
||
data "volcengine_mongodb_allow_lists" "foo"{ | ||
allow_list_ids = [volcengine_mongodb_allow_list.foo.id] | ||
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 |
---|---|---|
@@ -1,5 +1,47 @@ | ||
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_mongodb_instance" "foo"{ | ||
db_engine_version = "MongoDB_4_0" | ||
instance_type="ReplicaSet" | ||
super_account_password="@acc-test-123" | ||
node_spec="mongo.2c4g" | ||
mongos_node_spec="mongo.mongos.2c4g" | ||
instance_name="acc-test-mongo-replica" | ||
charge_type="PostPaid" | ||
project_name = "default" | ||
mongos_node_number = 32 | ||
shard_number=3 | ||
storage_space_gb=20 | ||
subnet_id=volcengine_subnet.foo.id | ||
zone_id= data.volcengine_zones.foo.zones[0].id | ||
tags { | ||
key = "k1" | ||
value = "v1" | ||
} | ||
} | ||
|
||
resource "volcengine_mongodb_instance_parameter" "foo" { | ||
instance_id = volcengine_mongodb_instance.foo.id | ||
parameter_name = "cursorTimeoutMillis" | ||
parameter_role = "Node" | ||
parameter_value = "600111" | ||
} | ||
|
||
data "volcengine_mongodb_instance_parameters" "foo"{ | ||
instance_id = "mongo-replica-f16e9298b121" // 必填 | ||
parameter_role = "Node" // 选填 | ||
parameter_names = "connPoolMaxConnsPerHost" // 选填 | ||
instance_id = volcengine_mongodb_instance.foo.id | ||
parameter_names = "cursorTimeoutMillis" | ||
parameter_role = "Node" | ||
} |
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 |
---|---|---|
@@ -1,3 +1,42 @@ | ||
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_mongodb_instance" "foo"{ | ||
db_engine_version = "MongoDB_4_0" | ||
instance_type="ReplicaSet" | ||
super_account_password="@acc-test-123" | ||
node_spec="mongo.2c4g" | ||
mongos_node_spec="mongo.mongos.2c4g" | ||
instance_name="acc-test-mongo-replica" | ||
charge_type="PostPaid" | ||
project_name = "default" | ||
mongos_node_number = 2 | ||
shard_number=3 | ||
storage_space_gb=20 | ||
subnet_id=volcengine_subnet.foo.id | ||
zone_id= data.volcengine_zones.foo.zones[0].id | ||
tags { | ||
key = "k1" | ||
value = "v1" | ||
} | ||
} | ||
|
||
resource "volcengine_mongodb_ssl_state" "foo" { | ||
instance_id = volcengine_mongodb_instance.foo.id | ||
} | ||
|
||
data "volcengine_mongodb_ssl_states" "foo"{ | ||
instance_id = "mongo-replica-f16e9298b121" // 必填 | ||
instance_id = volcengine_mongodb_instance.foo.id | ||
} |
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 |
---|---|---|
@@ -1,3 +1,62 @@ | ||
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_mongodb_instance" "foo"{ | ||
db_engine_version = "MongoDB_4_0" | ||
instance_type = "ShardedCluster" | ||
super_account_password = "@acc-test-123" | ||
node_spec = "mongo.shard.1c2g" | ||
mongos_node_spec = "mongo.mongos.1c2g" | ||
instance_name = "acc-test-mongo-shard" | ||
charge_type = "PostPaid" | ||
project_name = "default" | ||
mongos_node_number = 2 | ||
shard_number = 2 | ||
storage_space_gb = 20 | ||
subnet_id = volcengine_subnet.foo.id | ||
zone_id = data.volcengine_zones.foo.zones[0].id | ||
tags { | ||
key = "k1" | ||
value = "v1" | ||
} | ||
} | ||
|
||
resource "volcengine_eip_address" "foo" { | ||
billing_type = "PostPaidByBandwidth" | ||
bandwidth = 1 | ||
isp = "ChinaUnicom" | ||
name = "acc-eip-${count.index}" | ||
description = "acc-test" | ||
project_name = "default" | ||
count = 2 | ||
} | ||
|
||
resource "volcengine_mongodb_endpoint" "foo_public"{ | ||
instance_id = volcengine_mongodb_instance.foo.id | ||
network_type = "Public" | ||
object_id = volcengine_mongodb_instance.foo.mongos_id | ||
mongos_node_ids = [volcengine_mongodb_instance.foo.mongos[0].mongos_node_id, volcengine_mongodb_instance.foo.mongos[1].mongos_node_id] | ||
eip_ids = volcengine_eip_address.foo[*].id | ||
} | ||
|
||
resource "volcengine_mongodb_endpoint" "foo_private"{ | ||
instance_id = volcengine_mongodb_instance.foo.id | ||
network_type = "Private" | ||
object_id = volcengine_mongodb_instance.foo.config_servers_id | ||
} | ||
|
||
data "volcengine_mongodb_endpoints" "foo"{ | ||
instance_id="mongo-shard-xxx" | ||
instance_id = volcengine_mongodb_instance.foo.id | ||
} |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
resource "volcengine_mongodb_allow_list" "foo"{ | ||
allow_list_name="tf-test-hh" | ||
allow_list_desc="test1" | ||
resource "volcengine_mongodb_allow_list" "foo" { | ||
allow_list_name="acc-test" | ||
allow_list_desc="acc-test" | ||
allow_list_type="IPv4" | ||
allow_list="10.1.1.3,10.2.3.0/24,10.1.1.1" | ||
} |
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 |
---|---|---|
@@ -1,4 +1,46 @@ | ||
resource "volcengine_mongodb_allow_list_associate" "foo"{ | ||
instance_id="mongo-replica-f16e9298b121" | ||
allow_list_id="acl-9e307ce4efe843fb9ffd8cb6a6cb225f" | ||
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_mongodb_instance" "foo"{ | ||
db_engine_version = "MongoDB_4_0" | ||
instance_type="ReplicaSet" | ||
super_account_password="@acc-test-123" | ||
node_spec="mongo.2c4g" | ||
mongos_node_spec="mongo.mongos.2c4g" | ||
instance_name="acc-test-mongo-replica" | ||
charge_type="PostPaid" | ||
project_name = "default" | ||
mongos_node_number = 32 | ||
shard_number=3 | ||
storage_space_gb=20 | ||
subnet_id=volcengine_subnet.foo.id | ||
zone_id= data.volcengine_zones.foo.zones[0].id | ||
tags { | ||
key = "k1" | ||
value = "v1" | ||
} | ||
} | ||
|
||
resource "volcengine_mongodb_allow_list" "foo" { | ||
allow_list_name="acc-test" | ||
allow_list_desc="acc-test" | ||
allow_list_type="IPv4" | ||
allow_list="10.1.1.3,10.2.3.0/24,10.1.1.1" | ||
} | ||
|
||
resource "volcengine_mongodb_allow_list_associate" "foo" { | ||
allow_list_id = volcengine_mongodb_allow_list.foo.id | ||
instance_id = volcengine_mongodb_instance.foo.id | ||
} |
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 |
---|---|---|
@@ -1,7 +1,76 @@ | ||
resource "volcengine_mongodb_endpoint" "foo"{ | ||
instance_id="mongo-replica-38cf5badeb9e" | ||
# object_id="mongo-shard-8ad9f45e173e" | ||
network_type="Public" | ||
eip_ids= ["eip-3rfe12dvmz8qo5zsk2h91q05p"] | ||
# mongos_node_ids=["mongo-shard-8ad9f45e173e-0"] | ||
} | ||
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_eip_address" "foo" { | ||
billing_type = "PostPaidByBandwidth" | ||
bandwidth = 1 | ||
isp = "ChinaUnicom" | ||
name = "acc-eip-${count.index}" | ||
description = "acc-test" | ||
project_name = "default" | ||
count = 2 | ||
} | ||
|
||
resource "volcengine_mongodb_instance" "replica-set"{ | ||
db_engine_version = "MongoDB_4_0" | ||
instance_type="ReplicaSet" | ||
super_account_password="@acc-test-123" | ||
node_spec="mongo.2c4g" | ||
mongos_node_spec="mongo.mongos.2c4g" | ||
instance_name="acc-test-mongo-replica" | ||
charge_type="PostPaid" | ||
project_name = "default" | ||
mongos_node_number = 2 | ||
shard_number=3 | ||
storage_space_gb=20 | ||
subnet_id=volcengine_subnet.foo.id | ||
zone_id= data.volcengine_zones.foo.zones[0].id | ||
tags { | ||
key = "k1" | ||
value = "v1" | ||
} | ||
} | ||
|
||
resource "volcengine_mongodb_endpoint" "replica-set-public-endpoint"{ | ||
instance_id = volcengine_mongodb_instance.replica-set.id | ||
network_type = "Public" | ||
eip_ids = volcengine_eip_address.foo[*].id | ||
} | ||
|
||
resource "volcengine_mongodb_instance" "sharded-cluster"{ | ||
db_engine_version = "MongoDB_4_0" | ||
instance_type="ShardedCluster" | ||
super_account_password="@acc-test-123" | ||
node_spec="mongo.shard.1c2g" | ||
mongos_node_spec="mongo.mongos.1c2g" | ||
instance_name="acc-test-mongo-shard" | ||
charge_type="PostPaid" | ||
project_name = "default" | ||
mongos_node_number = 2 | ||
shard_number=2 | ||
storage_space_gb=20 | ||
subnet_id=volcengine_subnet.foo.id | ||
zone_id= data.volcengine_zones.foo.zones[0].id | ||
tags { | ||
key = "k1" | ||
value = "v1" | ||
} | ||
} | ||
|
||
resource "volcengine_mongodb_endpoint" "sharded-cluster-private-endpoint"{ | ||
instance_id = volcengine_mongodb_instance.sharded-cluster.id | ||
network_type = "Private" | ||
object_id = volcengine_mongodb_instance.sharded-cluster.shards[0].shard_id | ||
} |
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 |
---|---|---|
@@ -1,12 +1,41 @@ | ||
/* | ||
该资源无法创建,需先import资源 | ||
$ terraform import volcengine_mongodb_instance_parameter.default param:mongo-replica-f16e9298b121:connPoolMaxConnsPerHost | ||
请注意instance_id和parameter_name需与上述import的ID对应 | ||
*/ | ||
resource "volcengine_mongodb_instance_parameter" "default"{ | ||
instance_id = "mongo-replica-f16e9298b121" // 必填 import之后不允许修改 | ||
parameter_name = "connPoolMaxConnsPerHost" // 必填 import之后不允许修改 | ||
parameter_role = "Node" // 必填 | ||
parameter_value = "600" // 必填 | ||
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_mongodb_instance" "foo"{ | ||
db_engine_version = "MongoDB_4_0" | ||
instance_type="ReplicaSet" | ||
super_account_password="@acc-test-123" | ||
node_spec="mongo.2c4g" | ||
mongos_node_spec="mongo.mongos.2c4g" | ||
instance_name="acc-test-mongo-replica" | ||
charge_type="PostPaid" | ||
project_name = "default" | ||
mongos_node_number = 32 | ||
shard_number=3 | ||
storage_space_gb=20 | ||
subnet_id=volcengine_subnet.foo.id | ||
zone_id= data.volcengine_zones.foo.zones[0].id | ||
tags { | ||
key = "k1" | ||
value = "v1" | ||
} | ||
} | ||
|
||
resource "volcengine_mongodb_instance_parameter" "foo" { | ||
instance_id = volcengine_mongodb_instance.foo.id | ||
parameter_name = "cursorTimeoutMillis" | ||
parameter_role = "Node" | ||
parameter_value = "600111" | ||
} |
Oops, something went wrong.