Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(RDS): import RDS resource, unit test and document. #1058

Merged
merged 3 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions docs/data-sources/rds_backups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
subcategory: "Relational Database Service (RDS)"
---

# flexibleengine_rds_backups

Use this data source to get the list of RDS backups.

## Example Usage

```hcl
variable "instance_id" {}

data "flexibleengine_rds_backups" "test" {
instance_id = var.instance_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.

* `instance_id` - (Required, String) Specifies the DB instance ID.

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

* `backup_id` - (Optional, String) Specifies the backup ID.

* `backup_type` - (Optional, String) Specifies the backup type. The options are as follows:
- **auto**: Automated full backup.
- **manual**: Manual full backup.
- **fragment**: Differential full backup.
- **incremental**: Automated incremental backup.

* `begin_time` - (Optional, String) Specifies the start time for obtaining the backup list.
The format of the start time is "yyyy-mm-ddThh:mm:ssZ".

* `end_time` - (Optional, String) Specifies the end time for obtaining the backup list.
The format of the end time is "yyyy-mm-ddThh:mm:ssZ" and the end time must be later than the start time.

## Attribute Reference

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

* `id` - The resource ID.

* `backups` - Backup list. For details, see Data structure of the Backup field.
The [backups](#rds_backups) structure is documented below.

<a name="rds_backups"></a>
The `backups` block supports:

* `id` - Backup ID.

* `instance_id` - RDS instance ID.

* `name` - Backup name.

* `type` - Backup type. The options are as follows:
- **auto**: Automated full backup.
- **manual**: Manual full backup.
- **fragment**: Differential full backup.
- **incremental**: Automated incremental backup.

* `size` - Backup size in KB.

* `status` - Backup status. The options are as follows:
- **BUILDING**: Backup in progress.
- **COMPLETED**: Backup completed.
- **FAILED**: Backup failed.
- **DELETING**: Backup being deleted.

* `begin_time` - Backup start time in the "yyyy-mm-ddThh:mm:ssZ" format.

* `end_time` - Backup end time in the "yyyy-mm-ddThh:mm:ssZ" format.

* `associated_with_ddm` - Whether a DDM instance has been associated.

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

* `databases` - Database been backed up. The [databases](#rds_databases) structure is documented below.

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

* `type` - DB engine. The value can be: **MySQL**, **PostgreSQL**, **SQL Server**, **MariaDB**.

* `version` - DB engine version.

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

* `name` - Database to be backed up for Microsoft SQL Server.
40 changes: 40 additions & 0 deletions docs/data-sources/rds_engine_versions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
subcategory: "Relational Database Service (RDS)"
---

# flexibleengine_rds_engine_versions

Use this data source to obtain all version information of the specified engine type of FlexibleEngine.

## Example Usage

```hcl
data "flexibleengine_rds_engine_versions" "test" {
type = "SQLServer"
}
```

## Argument Reference

* `region` - (Optional, String) The region in which to obtain the RDS engine versions.
If omitted, the provider-level region will be used.

* `type` - (Optional, String) Specifies the RDS engine type.
The valid values are **MySQL**, **PostgreSQL**, **SQLServer** and **MariaDB**, default to **MySQL**.

## Attribute Reference

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

* `id` - Data source ID in hashcode format.

* `versions` - Indicates the list of database versions. The [versions](#rds_versions) object structure is
documented below.

<a name="rds_versions"></a>
The `versions` block supports:

* `id` - Indicates the database version ID. Its value is unique.

* `name` - Indicates the database version number. Only the major version number (two digits) is returned.
For example, if the version number is MySQL 5.6.X, only 5.6 is returned.
24 changes: 14 additions & 10 deletions docs/data-sources/rds_flavors_v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ data "flexibleengine_rds_flavors_v3" "flavor" {
* `region` - (Optional, String) The region in which to query the data source. If omitted, the provider-level region
will be used.

* `db_type` - (Required, String) Specifies the DB engine. Value: MySQL, PostgreSQL, SQLServer.
* `db_type` - (Required, String) Specifies the DB engine. Value: **MySQL**, **PostgreSQL**, **MariaDB**.
ShiChangkuo marked this conversation as resolved.
Show resolved Hide resolved

* `db_version` - (Required, String) Specifies the database version. MySQL databases support MySQL 5.6
and 5.7. PostgreSQL databases support PostgreSQL 9.5 and 9.6. Microsoft SQL Server databases support
2014_SE, 2016_SE, and 2016_EE.
* `db_version` - (Required, String) Specifies the database version. The supported versions of each database
are as follows:
- **MySQL**: MySQL databases support **5.6**, **5.7** and **8.0**.
- **PostgreSQL**: PostgreSQL databases support **9.5**, **9.6**, **10**, **11**, **12**, **13**, **14** and
**1.0 (Enhanced Edition)**.
- **SQLServer**: Microsoft SQL Server databases support **2014_SE**, **2016_SE** and **2016_EE**.
- **MariaDB**: MariaDB databases support **10.5**.

* `instance_mode` - (Optional, String) The mode of instance. Value: *ha*(indicates primary/standby instance),
*single*(indicates single instance) and *replica*(indicates read replicas).
Expand All @@ -36,12 +40,12 @@ data "flexibleengine_rds_flavors_v3" "flavor" {
* `memory` - (Optional, Int) Specifies the memory size(GB) in the RDS flavor.

* `group_type` - (Optional, String) Specifies the performance specification, the valid values are as follows:
+ **normal**: General enhanced.
+ **normal2**: General enhanced type II.
+ **dedicatedNormal**: (dedicatedNormalLocalssd): Dedicated for x86.
+ **normalLocalssd**: x86 general type.
+ **general**: General type.
+ **bigmem**: Large memory type.
- **normal**: General enhanced.
- **normal2**: General enhanced type II.
- **dedicatedNormal**: (dedicatedNormalLocalssd): Dedicated for x86.
- **normalLocalssd**: x86 general type.
- **general**: General type.
- **bigmem**: Large memory type.

* `availability_zone` - (Optional, String) Specifies the availability zone which the RDS flavor belongs to.

Expand Down
132 changes: 132 additions & 0 deletions docs/data-sources/rds_instances.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
---
subcategory: "Relational Database Service (RDS)"
---

# flexibleengine_rds_instances

Use this data source to list all available RDS instances.

## Example Usage

```hcl
data "flexibleengine_rds_instances" "test" {
name = "rds-instance"
}
```

## Argument Reference

* `region` - (Optional, String) The region in which query obtain the instances. If omitted, the provider-level region
will be used.

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

* `type` - (Optional, String) Specifies the type of the instance. Valid values are:
**Single**, **Ha**, **Replica**, and **Enterprise**.

* `datastore_type` - (Optional, String) Specifies the type of the database. Valid values are:
**MySQL**, **PostgreSQL**, **SQLServer** and **MariaDB**.

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

* `subnet_id` - (Optional, String) Specifies the network ID of a subnet.

* `enterprise_project_id` - (Optional, String) Specifies the enterprise project id.

## Attribute Reference

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

* `id` - The ID of the data source.

* `instances` - An array of available instances. The [instances](#rds_instances) object structure is documented below.

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

* `region` - The region of the instance.

* `name` - Indicates the name of the instance.

* `availability_zone` - Indicates the availability zone name.

* `flavor` - Indicates the instance specifications.

* `vpc_id` - Indicates the VPC ID.

* `subnet_id` - Indicates the network ID of a subnet.

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

* `security_group_id` - Indicates the security group ID.

* `param_group_id` - Indicates the configuration ID.

* `enterprise_project_id` - Indicates the enterprise project id.

* `fixed_ip` - Indicates the intranet floating IP address of the instance.

* `ssl_enable` - Indicates whether to enable SSL.

* `tags` - Indicates the tags of the instance.

* `ha_replication_mode` - Indicates the replication mode for the standby DB instance.

* `time_zone` - Indicates the time zone.

* `private_ips` - Indicates the private ips in list.

* `public_ips` - Indicates the public ips in list.

* `status` - Indicates the DB instance status.

* `created` - Indicates the creation time.

* `db` - Indicates the database information. The [db](#rds_db) object structure is documented below.

* `volume` - Indicates the volume information. The [volume](#rds_volume) object structure is documented below.

* `backup_strategy` - Indicates the advanced backup policy. The [backup_strategy](#rds_backup_strategy) object structure
is documented below.

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

<a name="rds_db"></a>
The `db` block supports:

* `type` - Indicates the database engine.

* `version` - Indicates the database version.

* `port` - Indicates the database port.

* `user_name` - Indicates the database username.

<a name="rds_volume"></a>
The `volume` block supports:

* `size` - Indicates the volume size.

* `type` - Indicates the volume type.

* `disk_encryption_id` - Indicates the kms key id.

<a name="rds_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.

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

* `id` - Indicates the node ID.

* `name` - Indicates the node name.

* `status` - Indicates the node status.

* `role` - Indicates the node type.

* `availability_zone` - Indicates the availability zone where the node resides.
70 changes: 70 additions & 0 deletions docs/data-sources/rds_storage_types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
subcategory: "Relational Database Service (RDS)"
---

# flexibleengine_rds_storage_types

Use this data source to get the list of RDS storage types.

## Example Usage

```hcl
variable "instance_id" {}

data "flexibleengine_rds_storage_types" "test" {
db_type = "MySQL"
db_version = "8.0"
}
```

## 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.

* `db_type` - (Required, String) Specifies the DB engine type. Its value can be any of the following and
is case-insensitive: **MySQL**, **PostgreSQL**, **SQLServer** and **MariaDB**.

* `db_version` - (Required, String) Specifies the database version. For details about how to obtain the database
version, see section [Querying Version Information About a DB Engine](https://docs.prod-cloud-ocb.orange-business.com/en-us/api/rds/rds_06_0001.html).

* `instance_mode` - (Optional, String) Specifies the HA mode. The value options are as
follows: **single**, **ha**, **replica**.

## Attribute Reference

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

* `id` - The resource ID.

* `storage_types` - Indicates the DB instance specifications information list. For details, see Data structure of
Zippo-Wang marked this conversation as resolved.
Show resolved Hide resolved
the storage_type field. The [storage_types](#Storagetype_storageType) structure is documented below.

<a name="Storagetype_storageType"></a>
The `storage_types` block supports:

* `name` - Indicates the storage type. Its value can be any of the following:
- **COMMON**: Indicates the SATA type.
- **ULTRAHIGH**: Indicates the SSD type.

* `az_status` - The status details of the AZs to which the specification belongs.
Key indicates the AZ ID, and value indicates the specification status in the AZ.
The options of value are as follows:
- **normal**: The specifications in the AZ are available.
- **unsupported**: The specifications are not supported by the AZ.
- **sellout**: The specifications in the AZ are sold out.

* `support_compute_group_type` - Performance specifications.
The options are as follows:
- **normal**: General-enhanced.
- **normal2**: General-enhanced II.
- **armFlavors**: Kunpeng general-enhanced.
- **dedicicatenormal**: Exclusive x86.
- **armlocalssd**: Standard Kunpeng.
- **normallocalssd**: Standard x86.
- **general**: General-purpose.
- **dedicated**: Dedicated, which is only supported for cloud SSDs.
- **rapid**: Dedicated, which is only supported for extreme SSDs.
- **bigmen**: Large-memory.
Loading
Loading