-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(document_db): add resources (#2109)
* feat(document_db): add instance resource * lint * feat(document_db): add database resource * feat(documentdb): resources documentdb * feat(documentdb): replica resource * chore: add DocumentDB to CI test * chore: test cassettes * chore: test cassettes * fix(documentdb): fix test * docs(documentdb): add documentation resources * feat(documentdb): add resources private network and datasource load balander * fix(documentdb): remve unused helpers * fix(documentdb): test resource naming * feat(documentdb): add privilege basic cassette * feat(documentdb): add missing cassettes * docs: update documentdb documentation * fix(documentdb): rename telemetry variable * docs: update documentation link * fix(documentdb): renambe file test * chore: add cassettes files * fix(documentdb): update test * fix(documentdb): update test * fix(documentdb): update test * fix(documentdb): linter issue on set const * fix(documentdb): remove telemetry option * fix(documentdb): revert telemetry setter * fix(documentdb): remove telemetry enabled * fix(documentdb): remove optional parameter on test * fix(documentdb): remove is_ha_cluter on test * fix(documentdb): remove telemetry_enabled on test --------- Co-authored-by: jaime Bernabe <[email protected]>
- Loading branch information
Showing
44 changed files
with
22,967 additions
and
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ jobs: | |
- Cockpit | ||
- Container | ||
- Domain | ||
- DocumentDB | ||
- Function | ||
- Iam | ||
- Instance | ||
|
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 |
---|---|---|
|
@@ -16,6 +16,7 @@ jobs: | |
- Baremetal | ||
- Cockpit | ||
- Domain | ||
- DocumentDB | ||
- Function | ||
- Container | ||
- Iam | ||
|
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,37 @@ | ||
--- | ||
subcategory: "Databases" | ||
layout: "scaleway" | ||
page_title: "Scaleway: scaleway_document_db_database" | ||
--- | ||
|
||
# scaleway_document_db_database | ||
|
||
Gets information about DocumentDB database. More on our official [site](https://www.scaleway.com/en/developers/api/document_db/) | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
# Get the database foobar hosted on instance id 11111111-1111-1111-1111-111111111111 | ||
data scaleway_document_db_database main { | ||
instance_id = "11111111-1111-1111-1111-111111111111" | ||
name = "foobar" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
- `instance_id` - (Required) The DocumentDB instance ID. | ||
|
||
- `name` - (Required) The name of the DocumentDB instance. | ||
|
||
## Attributes Reference | ||
|
||
In addition to all above arguments, the following attributes are exported: | ||
|
||
- `id` - The ID of the database. | ||
|
||
~> **Important:** DocumentDB databases' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{instance-id}/{database-name}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111/database` | ||
|
||
- `owner` - The name of the owner of the database. | ||
- `managed` - Whether the database is managed or not. | ||
- `size` - Size of the database (in bytes). |
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,45 @@ | ||
--- | ||
subcategory: "Databases" | ||
layout: "scaleway" | ||
page_title: "Scaleway: scaleway_document_db_instance" | ||
--- | ||
|
||
# scaleway_document_db_instance | ||
|
||
Gets information about an DocumentDB instance. For further information see our [developers website](https://www.scaleway.com/en/developers/api/document_db/) | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
# Get info by name | ||
data "scaleway_document_db_instance" "db" { | ||
name = "foobar" | ||
} | ||
# Get info by instance ID | ||
data "scaleway_document_db_instance" "db" { | ||
instance_id = "11111111-1111-1111-1111-111111111111" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
- `name` - (Optional) The name of the DocumentDB instance. | ||
Only one of `name` and `instance_id` should be specified. | ||
|
||
- `instance_id` - (Optional) The DocumentDB instance ID. | ||
Only one of `name` and `instance_id` should be specified. | ||
|
||
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#zones) in which the DocumentDB instance exists. | ||
|
||
- `organization_id` - (Defaults to [provider](../index.md#organization_id) `organization_id`) The ID of the organization the DocumentDB instance is in. | ||
|
||
## Attributes Reference | ||
|
||
In addition to all above arguments, the following attributes are exported: | ||
|
||
- `id` - The ID of the DocumentDB instance. | ||
|
||
~> **Important:** DocumentDB instances' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` | ||
|
||
Exported attributes are the ones from `scaleway_document_db_instance` [resource](../resources/documentdb_instance.md) |
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,49 @@ | ||
--- | ||
subcategory: "Databases" | ||
page_title: "Scaleway: scaleway_document_db_database" | ||
--- | ||
|
||
# scaleway_document_db_database | ||
|
||
Creates and manages Scaleway DocumentDB database. | ||
For more information, see [the documentation](https://developers.scaleway.com/en/products/rdb/api). | ||
|
||
## Examples | ||
|
||
### Basic | ||
|
||
```hcl | ||
resource "scaleway_document_db_database" "main" { | ||
instance_id = "11111111-1111-1111-1111-111111111111" | ||
name = "my-new-database" | ||
} | ||
``` | ||
|
||
## Arguments Reference | ||
|
||
The following arguments are supported: | ||
|
||
- `instance_id` - (Required) UUID of the documentdb instance. | ||
|
||
~> **Important:** Updates to `instance_id` will recreate the Database. | ||
|
||
- `name` - (Required) Name of the database (e.g. `my-new-database`). | ||
|
||
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the resource exists. | ||
|
||
## Attributes Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
- `id` - The ID of the database, which is of the form `{region}/{id}/{DBNAME}` e.g. `fr-par/11111111-1111-1111-1111-111111111111/mydb` | ||
- `owner` - The name of the owner of the database. | ||
- `managed` - Whether the database is managed or not. | ||
- `size` - Size in gigabytes of the database. | ||
|
||
## Import | ||
|
||
DocumentDB Database can be imported using the `{region}/{id}/{DBNAME}`, e.g. | ||
|
||
```bash | ||
$ terraform import scaleway_document_db_database.mydb fr-par/11111111-1111-1111-1111-111111111111/mydb | ||
``` |
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,83 @@ | ||
--- | ||
subcategory: "Databases" | ||
page_title: "Scaleway: scaleway_documentdb_instance" | ||
--- | ||
|
||
# scaleway_documentdb_instance | ||
|
||
Creates and manages Scaleway Database Instances. | ||
For more information, see [the documentation](https://www.scaleway.com/en/developers/api/document_db/). | ||
|
||
## Examples | ||
|
||
### Example Basic | ||
|
||
```hcl | ||
resource "scaleway_documentdb_instance" "main" { | ||
name = "test-documentdb-instance-basic" | ||
node_type = "docdb-play2-pico" | ||
engine = "FerretDB-1" | ||
user_name = "my_initial_user" | ||
password = "thiZ_is_v&ry_s3cret" | ||
tags = ["terraform-test", "scaleway_documentdb_instance", "minimal"] | ||
volume_size_in_gb = 20 | ||
} | ||
``` | ||
|
||
## Arguments Reference | ||
|
||
The following arguments are supported: | ||
|
||
- `node_type` - (Required) The type of database instance you want to create (e.g. `docdb-play2-pico`). | ||
|
||
~> **Important:** Updates to `node_type` will upgrade the Database Instance to the desired `node_type` without any | ||
interruption. Keep in mind that you cannot downgrade a Database Instance. | ||
|
||
- `engine` - (Required) Database Instance's engine version (e.g. `FerretDB-1`). | ||
|
||
~> **Important:** Updates to `engine` will recreate the Database Instance. | ||
|
||
- `volume_type` - (Optional, default to `lssd`) Type of volume where data are stored (`bssd` or `lssd`). | ||
|
||
- `volume_size_in_gb` - (Optional) Volume size (in GB) when `volume_type` is set to `bssd`. | ||
|
||
- `user_name` - (Optional) Identifier for the first user of the database instance. | ||
|
||
~> **Important:** Updates to `user_name` will recreate the Database Instance. | ||
|
||
- `password` - (Optional) Password for the first user of the database instance. | ||
|
||
- `is_ha_cluster` - (Optional) Enable or disable high availability for the database instance. | ||
|
||
- `telemetry_enabled` - (Optional) Enable telemetry to collects basic anonymous usage data and sends them to FerretDB telemetry service. More about the telemetry [here](https://docs.ferretdb.io/telemetry/#configure-telemetry). | ||
|
||
~> **Important:** Updates to `is_ha_cluster` will recreate the Database Instance. | ||
|
||
- `name` - (Optional) The name of the Database Instance. | ||
|
||
- `tags` - (Optional) The tags associated with the Database Instance. | ||
|
||
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) | ||
in which the Database Instance should be created. | ||
|
||
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the Database | ||
Instance is associated with. | ||
|
||
## Attributes Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
- `id` - The ID of the Database Instance. | ||
|
||
~> **Important:** Database instances' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they | ||
are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` | ||
|
||
- `organization_id` - The organization ID the Database Instance is associated with. | ||
|
||
## Import | ||
|
||
Database Instance can be imported using the `{region}/{id}`, e.g. | ||
|
||
```bash | ||
$ terraform import scaleway_documentdb_instance.db fr-par/11111111-1111-1111-1111-111111111111 | ||
``` |
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,69 @@ | ||
--- | ||
subcategory: "Databases" | ||
page_title: "Scaleway: scaleway_document_db_private_network_endpoint" | ||
--- | ||
|
||
# scaleway_document_db_private_network_endpoint | ||
|
||
Creates and manages Scaleway Database Private Network Endpoint. | ||
For more information, see [the documentation](https://www.scaleway.com/en/developers/api/document_db/). | ||
|
||
## Examples | ||
|
||
### Example Basic | ||
|
||
```hcl | ||
resource "scaleway_vpc_private_network" "pn" { | ||
name = "my_private_network" | ||
} | ||
resource "scaleway_document_db_private_network_endpoint" "main" { | ||
instance_id = "11111111-1111-1111-1111-111111111111" | ||
private_network { | ||
ip_net = "172.16.32.3/22" | ||
id = scaleway_vpc_private_network.pn.id | ||
} | ||
depends_on = [scaleway_vpc_private_network.pn] | ||
} | ||
``` | ||
|
||
## Arguments Reference | ||
|
||
The following arguments are supported: | ||
|
||
- `instance_id` - (Required) UUID of the documentdb instance. | ||
|
||
- `ip_net` - (Optional) The IP network address within the private subnet. This must be an IPv4 address with a | ||
CIDR notation. The IP network address within the private subnet is determined by the IP Address Management (IPAM) | ||
service if not set. | ||
|
||
- `private_network_id` - (Required) The ID of the private network. | ||
|
||
## Private Network | ||
|
||
~> **Important:** Updates to `private_network_id` will recreate the attachment Instance. | ||
|
||
~> **NOTE:** Please calculate your host IP. | ||
using [cirhost](https://developer.hashicorp.com/terraform/language/functions/cidrhost). Otherwise, lets IPAM service | ||
handle the host IP on the network. | ||
|
||
## Attributes Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
- `ip` - IPv4 address on the network. | ||
- `port` - Port in the Private Network. | ||
- `name` - Name of the endpoint. | ||
- `hostname` - Hostname of the endpoint. | ||
|
||
|
||
~> **Important:** Database instances' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they | ||
are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111` | ||
|
||
## Import | ||
|
||
Database Instance Endpoint can be imported using the `{region}/{endpoint_id}`, e.g. | ||
|
||
```bash | ||
$ terraform import scaleway_document_db_private_network_endpoint.end fr-par/11111111-1111-1111-1111-111111111111 | ||
``` |
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,49 @@ | ||
--- | ||
subcategory: "Databases" | ||
page_title: "Scaleway: scaleway_document_db_privilege" | ||
--- | ||
|
||
# scaleway_document_db_privilege | ||
|
||
Create and manage Scaleway DocumentDB database privilege. | ||
For more information, see [the documentation](https://www.scaleway.com/en/developers/api/document_db/). | ||
|
||
## Example usage | ||
|
||
```hcl | ||
resource "scaleway_document_db_privilege" "main" { | ||
instance_id = "11111111-1111-1111-1111-111111111111" | ||
user_name = "my-db-user" | ||
database_name = "my-db-name" | ||
permission = "all" | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
- `instance_id` - (Required) UUID of the rdb instance. | ||
|
||
- `user_name` - (Required) Name of the user (e.g. `my-db-user`). | ||
|
||
- `database_name` - (Required) Name of the database (e.g. `my-db-name`). | ||
|
||
- `permission` - (Required) Permission to set. Valid values are `readonly`, `readwrite`, `all`, `custom` and `none`. | ||
|
||
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the resource exists. | ||
|
||
## Attributes Reference | ||
|
||
In addition to all arguments above, the following attributes are exported: | ||
|
||
- `id` - The ID of the user privileges, which is of the form `{region}/{instance_id}/{database_name}/{user_name}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111/database_name/foo` | ||
|
||
## Import | ||
|
||
The user privileges can be imported using the `{region}/{instance_id}/{database_name}/{user_name}`, e.g. | ||
|
||
```bash | ||
$ terraform import scaleway_document_db_privilege.o fr-par/11111111-1111-1111-1111-111111111111/database_name/foo | ||
``` |
Oops, something went wrong.