-
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 #61 from volcengine/feat/mongodb
Feat/mongodb
- Loading branch information
Showing
72 changed files
with
5,316 additions
and
5 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_mongodb_accounts" "default"{ | ||
instance_id = "mongo-replica-xxx" | ||
} |
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 @@ | ||
data "volcengine_mongodb_allow_lists" "default"{ | ||
region_id = "cn-xxx" | ||
instance_id="mongo-replica-xxx" | ||
allow_list_ids=["acl-2ecfc3318fd24bfab6xxx","acl-ada659ab83e941d6adc2xxxf"] | ||
} |
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 @@ | ||
data "volcengine_mongodb_instance_parameter_logs" "foo"{ | ||
instance_id="mongo-replica-xxx" | ||
start_time="2022-11-14 00:00Z" | ||
end_time="2022-11-14 18:15Z" | ||
} |
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_mongodb_instance_parameters" "foo"{ | ||
instance_id="mongo-replica-xxx" | ||
} |
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,2 @@ | ||
data "volcengine_mongodb_regions" "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_mongodb_ssl_states" "foo"{ | ||
instance_id="mongo-shard-xxx" | ||
} |
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_mongodb_specs" "foo"{ | ||
region_id="cn-xxx" | ||
} |
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_mongodb_zones" "default"{ | ||
region_id = "XXX" | ||
} |
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_mongodb_endpoints" "foo"{ | ||
instance_id="mongo-shard-xxx" | ||
} |
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_mongodb_instances" "foo"{ | ||
instance_id="mongo-replica-xxx" | ||
} |
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_mongodb_allow_list" "foo"{ | ||
allow_list_name="tf-test" | ||
allow_list_desc="test" | ||
allow_list_type="IPv4" | ||
allow_list="10.1.1.1,10.1.1.2,10.1.1.3,10.2.3.0/24" | ||
} |
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_mongodb_allow_list_associate" "foo"{ | ||
instance_id="mongo-replica-b2xxx" | ||
allow_list_id="acl-4d66bec945d14fa48xxx" | ||
} |
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_mongodb_endpoint" "foo"{ | ||
instance_id="mongo-shard-xxx" | ||
object_id="mongo-shard-xxx-s1" | ||
network_type="Public" | ||
eip_ids=["eip-xx","eip-xx"] | ||
} |
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_mongodb_endpoint" "foo"{ | ||
instance_id="mongo-shard-9e031cea119b" | ||
object_id="mongo-shard-9e031cea119b-s0" | ||
network_type="Private" | ||
} |
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,15 @@ | ||
resource "volcengine_mongodb_instance" "foo"{ | ||
zone_id="cn-xxx" | ||
instance_type="ShardedCluster" | ||
node_spec="mongo.xxx" | ||
mongos_node_spec="mongo.mongos.xxx" | ||
shard_number=3 | ||
storage_space_gb=100 | ||
subnet_id="subnet-2d6pxxu" | ||
instance_name="tf-test" | ||
charge_type="PostPaid" | ||
# period_unit="Month" | ||
# period=1 | ||
# auto_renew=false | ||
# ssl_action="Close" | ||
} |
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_mongodb_instance_parameter" "foo"{ | ||
instance_id="mongo-replica-b2xxx" | ||
parameter_name="connPoolMaxConnsPerHost" | ||
parameter_role="Node" | ||
parameter_value="800" | ||
} |
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_mongodb_ssl_state" "foo"{ | ||
instance_id="mongo-shard-xxx" | ||
ssl_action="Update" | ||
} |
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,15 @@ | ||
resource "volcengine_mongodb_instance" "foo"{ | ||
# region_id="cn-xxx" | ||
# zone_ids=["cn-xxx"] | ||
# instance_name="test-22" | ||
# sharded_cluster=0 | ||
# password="1qaz!QAZ" | ||
# node_number=2 | ||
# shard_capacity=1024 | ||
# engine_version="5.0" | ||
# vpc_id="vpc-274d24a6ece807fap8***" | ||
# subnet_id="subnet-274o6znje5iww7fa***" | ||
# charge_type="PrePaid" | ||
# purchase_months=1 | ||
# auto_renew=false | ||
} |
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
File renamed without changes.
File renamed without changes.
80 changes: 80 additions & 0 deletions
80
volcengine/mongodb/account/data_source_volcengine_mongodb_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,80 @@ | ||
package account | ||
|
||
import ( | ||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema" | ||
"github.com/hashicorp/terraform-plugin-sdk/helper/validation" | ||
ve "github.com/volcengine/terraform-provider-volcengine/common" | ||
) | ||
|
||
func DataSourceVolcengineMongoDBAccounts() *schema.Resource { | ||
return &schema.Resource{ | ||
Read: dataSourceVolcengineAccountsRead, | ||
Schema: map[string]*schema.Schema{ | ||
"instance_id": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
// ForceNew: true, | ||
Description: "Target query mongo instance id.", | ||
}, | ||
"account_name": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Description: "The name of account, current support only `root`.", | ||
ValidateFunc: validation.StringInSlice([]string{"root"}, false), | ||
}, | ||
"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 accounts query.", | ||
}, | ||
"accounts": { | ||
Description: "The collection of accounts 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 account.", | ||
}, | ||
"account_type": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The type of account.", | ||
}, | ||
"account_privileges": { | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Description: "The privilege info of mongo instance.", | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"db_name": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The Name of DB.", | ||
}, | ||
"role_name": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
Description: "The Name of role.", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func dataSourceVolcengineAccountsRead(d *schema.ResourceData, meta interface{}) error { | ||
regionService := NewMongoDBAccountService(meta.(*ve.SdkClient)) | ||
return regionService.Dispatcher.Data(regionService, d, DataSourceVolcengineMongoDBAccounts()) | ||
} |
Oops, something went wrong.