Skip to content

Commit

Permalink
fix(RDS): import RDS resource and add unit test and document.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zippo-Wang committed Oct 31, 2023
1 parent cbbb55d commit 7372589
Show file tree
Hide file tree
Showing 16 changed files with 1,895 additions and 6 deletions.
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**, **SQLServer**.

* `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** and **SQLServer**, 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.
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**, and **SQLServer**.

* `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**.

* `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
the storage_type field. The [storage_type](#Storagetype_storageType) structure is documented below.

<a name="Storagetype_storageType"></a>
The `storage_type` 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

0 comments on commit 7372589

Please sign in to comment.