Skip to content

Commit

Permalink
feat(DDS): import DDS resource, unit test and document.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zippo-Wang committed Nov 25, 2023
1 parent 2d17d17 commit 6d2d5c4
Show file tree
Hide file tree
Showing 10 changed files with 1,191 additions and 7 deletions.
116 changes: 116 additions & 0 deletions docs/data-sources/dds_instances.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
subcategory: "Document Database Service (DDS)"
---

# flexibleengine_dds_instances_v3

Use this data source to get the list of DDS instances.

## Example Usage

```hcl
variable "vpc_id" {}
variable "subnet_id" {}
data "flexibleengine_dds_instances" "test" {
name = "test_name"
mode = "Sharding"
vpc_id = var.vpc_id
subnet_id = var.subnet_id
}
```

## Argument Reference

The following arguments are supported:

* `region` - (Optional, String) Specifies the region in which to query the data source. If omitted, the provider-level
region will be used.

* `name` - (Optional, String) Specifies the DB instance name.

* `mode` - (Optional, String) Specifies the mode of the database instance.

* `vpc_id` - (Optional, String) Specifies the VPC ID.

* `subnet_id` - (Optional, String) Specifies the subnet Network ID.

## Attribute Reference

In addition to all arguments above, the following attributes are exported:

* `id` - The resource ID.

* `instances` - Indicates the list of DDS instances.
The [instances](#dds_instances) object structure is documented below.

<a name="dds_instances"></a>
The `instances` block supports:

* `id` - Indicates the ID of the instance.

* `name` - Indicates the DB instance name.

* `ssl` - Indicates whether to enable or disable SSL.

* `port` - Indicates the database port number. The port range is 2100 to 9500.

* `datastore` - Indicates database information.
The [datastore](#dds_datastore) object structure is documented below.

* `backup_strategy` - Indicates backup strategy.
The [backup_strategy](#dds_backup_strategy) object structure is documented below.

* `vpc_id` - Indicates the VPC ID.

* `subnet_id` - Indicates the subnet Network ID.

* `security_group_id` - Indicates the security group ID of the DDS instance.

* `disk_encryption_id` - Indicates the disk encryption ID of the instance.

* `mode` - Specifies the mode of the database instance.

* `db_username` - Indicates the DB Administrator name.

* `status` - Indicates the DB instance status.

* `enterprise_project_id` - Indicates the enterprise project id of the dds instance.

* `nodes` - Indicates the instance nodes information.
The [nodes](#dds_nodes) object structure is documented below.

* `tags` - Indicates the key/value pairs to associate with the DDS instance.

<a name="dds_datastore"></a>
The `datastore` block supports:

* `type` - Indicates the DB engine.

* `version` - Indicates the DB instance version.

* `storage_engine` - Indicates the storage engine of the DB instance.

<a name="dds_backup_strategy"></a>
The `backup_strategy` block supports:

* `start_time` - Indicates the backup time window.

* `keep_days` - Indicates the number of days to retain the generated backup files.

<a name="dds_nodes"></a>
The `nodes` block supports:

* `id` - Indicates the node ID.

* `name` - Indicates the node name.

* `role` - Indicates the node role.

* `type` - Indicates the node type.

* `private_ip` - Indicates the private IP address of a node.

* `public_ip` - Indicates the EIP that has been bound on a node.

* `status` - Indicates the node status.
62 changes: 62 additions & 0 deletions docs/resources/dds_audit_log_policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
subcategory: "Document Database Service (DDS)"
---

# flexibleengine_dds_audit_log_policy_v3

Manages a DDS audit log policy resource within FlexibleEngine.

## Example Usage

```hcl
variable "instance_id" {}
variable "keep_days" {}
resource "flexibleengine_dds_audit_log_policy" "test"{
instance_id = var.instance_id
keep_days = var.keep_days
}
```

## Argument Reference

The following arguments are supported:

* `region` - (Optional, String, ForceNew) Specifies the region in which to create the resource.
If omitted, the provider-level region will be used. Changing this parameter will create a new resource.

* `instance_id` - (Required, String, ForceNew) Specifies the ID of the DDS instance.

Changing this parameter will create a new resource.

* `keep_days` - (Required, Int) Specifies the number of days for storing audit logs. The value ranges from 7 to 732.

* `audit_scope` - (Optional, String) Specifies the audit scope.
If this parameter is left blank or set to **all**, all audit log policies are enabled.
You can enter the database or collection name. Use commas (,) to separate multiple databases
or collections. If the name contains a comma (,), add a dollar sign ($) before the comma
to distinguish it from the separators. Enter a maximum of 1024 characters. The value
cannot contain spaces or the following special characters "[]{}():? The dollar sign ($)
can be used only in escape mode.

* `audit_types` - (Optional, List) Specifies the audit type. The value is **auth**, **insert**, **delete**, **update**,
**query** or **command**.

* `reserve_auditlogs` - (Optional, String) Specifies whether the historical audit logs are
retained when SQL audit is disabled.
+ **true**: indicates that historical audit logs are retained when SQL audit is disabled.(default value)
+ **false**: indicates that existing historical audit logs are deleted when SQL audit is disabled.

## Attribute Reference

In addition to all arguments above, the following attributes are exported:

* `id` - The resource ID.

## Import

The DDS audit log policy can be imported using the instance ID, e.g.:

```shell
terraform import flexibleengine_dds_audit_log_policy.test <instance_id>
```
85 changes: 85 additions & 0 deletions docs/resources/dds_backup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
subcategory: "Document Database Service (DDS)"
---

# flexibleengine_dds_backup_v3

Manages a DDS backup resource within FlexibleEngine.

## Example Usage

```hcl
variable "dds_instance_id" {}
variable "name" {}
resource "flexibleengine_dds_backup" "test"{
instance_id = var.dds_instance_id
name = var.name
}
```

## Argument Reference

The following arguments are supported:

* `region` - (Optional, String, ForceNew) Specifies the region in which to create the resource.
If omitted, the provider-level region will be used. Changing this parameter will create a new resource.

* `instance_id` - (Required, String, ForceNew) Specifies the ID of a DDS instance.
Changing this parameter will create a new resource.

* `name` - (Required, String, ForceNew) Specifies the manual backup name.
The value must be 4 to 64 characters in length and start with a letter (from A to Z or from a to z).
It is case-sensitive and can contain only letters, digits (from 0 to 9), hyphens (-), and underscores (_).
Changing this parameter will create a new resource.

* `description` - (Optional, String, ForceNew) Specifies the manual backup description.
Changing this parameter will create a new resource.

## Attribute Reference

In addition to all arguments above, the following attributes are exported:

* `id` - The resource ID.

* `instance_name` - Indicates the name of a DDS instance.

* `datastore` - Indicates the database version.
The [datastore](#dds_datastore) object structure is documented below.

* `type` - Indicates the backup type. Valid value:
+ **Manual**: indicates manual full backup.

* `begin_time` - Indicates the start time of the backup. The format is yyyy-mm-dd hh:mm:ss. The value is in UTC format.

* `end_time` - Indicates the end time of the backup. The format is yyyy-mm-dd hh:mm:ss. The value is in UTC format.

* `status` - Indicates the backup status. Valid value:
+ **BUILDING**: Backup in progress.
+ **COMPLETED**: Backup completed.
+ **FAILED**: Backup failed.
+ **DISABLED**: Backup being deleted.

* `size` - Indicates the backup size in KB.

<a name="dds_datastore"></a>
The `datastore` block supports:

* `type` - Indicates the DB engine.

* `version` - Indicates the database version. The value can be **4.2**, **4.0**, or **3.4**.

## Timeouts

This resource provides the following timeouts configuration options:

* `create` - Default is 30 minutes.
* `delete` - Default is 10 minutes.

## Import

The DDS backup can be imported using the instance ID and the backup ID separated by a slash, e.g.:

```shell
terraform import flexibleengine_dds_backup.test 6fb8b99944c7459da32f751f0edea756br02/0ce123456a00f2591fabc00385ff1234
```
93 changes: 93 additions & 0 deletions docs/resources/dds_parameter_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
subcategory: "Document Database Service (DDS)"
---

# flexibleengine_dds_parameter_template_v3

Manages a DDS parameter template resource within FlexibleEngine.

## Example Usage

```hcl
variable "name" {}
variable "parameter_values" {}
variable "node_type" {}
variable "node_version" {}
resource "flexibleengine_dds_parameter_template" "test"{
name = var.name
parameter_values = var.parameter_values
node_type = var.node_type
node_version = var.node_version
}
```

## Argument Reference

The following arguments are supported:

* `region` - (Optional, String, ForceNew) Specifies the region in which to create the resource.
If omitted, the provider-level region will be used. Changing this parameter will create a new resource.

* `name` - (Required, String) Specifies the parameter template name.
The value must be 1 to 64 characters in length and start with a letter (from A to Z or from a to z).
It is case-sensitive and can contain only letters, digits (from 0 to 9), hyphens (-), and underscores (_).

* `node_type` - (Required, String, ForceNew) Specifies the node type of parameter template node_type. Valid value:
+ **mongos**: the mongos node type.
+ **shard**: the shard node type.
+ **config**: the config node type.
+ **replica**: the replica node type.
+ **single**: the single node type.

Changing this parameter will create a new resource.

* `node_version` - (Required, String, ForceNew) Specifies the database version.
The value can be **4.2**, **4.0** or **3.4**.

Changing this parameter will create a new resource.

* `parameter_values` - (Optional, Map) Specifies the mapping between parameter names and parameter values.
You can customize parameter values based on the parameters in the default parameter template.

* `description` - (Optional, String) Specifies the parameter template description.
The description must consist of a maximum of 256 characters and cannot contain the carriage
return character or the following special characters: >!<"&'=.

## Attribute Reference

In addition to all arguments above, the following attributes are exported:

* `id` - The resource ID.

* `parameters` - Indicates the parameters defined by users based on the default parameter templates.
The [parameters](#DdsParameterTemplate_Parameter) structure is documented below.

<a name="DdsParameterTemplate_Parameter"></a>
The `parameters` block supports:

* `name` - Indicates the parameter name.

* `value` - Indicates the parameter value.

* `description` - Indicates the parameter description.

* `type` - Indicates the parameter type. The value can be integer, string, boolean, float, or list.

* `value_range` - Indicates the value range.

* `restart_required` - Indicates whether the instance needs to be restarted.
+ If the value is **true**, restart is required.
+ If the value is **false**, restart is not required.

* `readonly` - Indicates whether the parameter is read-only.
+ If the value is **true**, the parameter is read-only.
+ If the value is **false**, the parameter is not read-only.

## Import

The DDS parameter template can be imported using the `id`, e.g.

```shell
terraform import flexibleengine_dds_parameter_template.test <tempalate_id>
```
Loading

0 comments on commit 6d2d5c4

Please sign in to comment.