Skip to content

Commit 2f91ca5

Browse files
CodelaxMonitob
andauthored
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]>
1 parent e6ccf31 commit 2f91ca5

File tree

44 files changed

+22967
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+22967
-84
lines changed

.github/workflows/acceptance-tests.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
- Cockpit
1717
- Container
1818
- Domain
19+
- DocumentDB
1920
- Function
2021
- Iam
2122
- Instance

.github/workflows/nightly.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
- Baremetal
1717
- Cockpit
1818
- Domain
19+
- DocumentDB
1920
- Function
2021
- Container
2122
- Iam
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
subcategory: "Databases"
3+
layout: "scaleway"
4+
page_title: "Scaleway: scaleway_document_db_database"
5+
---
6+
7+
# scaleway_document_db_database
8+
9+
Gets information about DocumentDB database. More on our official [site](https://www.scaleway.com/en/developers/api/document_db/)
10+
11+
## Example Usage
12+
13+
```hcl
14+
# Get the database foobar hosted on instance id 11111111-1111-1111-1111-111111111111
15+
data scaleway_document_db_database main {
16+
instance_id = "11111111-1111-1111-1111-111111111111"
17+
name = "foobar"
18+
}
19+
```
20+
21+
## Argument Reference
22+
23+
- `instance_id` - (Required) The DocumentDB instance ID.
24+
25+
- `name` - (Required) The name of the DocumentDB instance.
26+
27+
## Attributes Reference
28+
29+
In addition to all above arguments, the following attributes are exported:
30+
31+
- `id` - The ID of the database.
32+
33+
~> **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`
34+
35+
- `owner` - The name of the owner of the database.
36+
- `managed` - Whether the database is managed or not.
37+
- `size` - Size of the database (in bytes).
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
subcategory: "Databases"
3+
layout: "scaleway"
4+
page_title: "Scaleway: scaleway_document_db_instance"
5+
---
6+
7+
# scaleway_document_db_instance
8+
9+
Gets information about an DocumentDB instance. For further information see our [developers website](https://www.scaleway.com/en/developers/api/document_db/)
10+
11+
## Example Usage
12+
13+
```hcl
14+
# Get info by name
15+
data "scaleway_document_db_instance" "db" {
16+
name = "foobar"
17+
}
18+
19+
# Get info by instance ID
20+
data "scaleway_document_db_instance" "db" {
21+
instance_id = "11111111-1111-1111-1111-111111111111"
22+
}
23+
```
24+
25+
## Argument Reference
26+
27+
- `name` - (Optional) The name of the DocumentDB instance.
28+
Only one of `name` and `instance_id` should be specified.
29+
30+
- `instance_id` - (Optional) The DocumentDB instance ID.
31+
Only one of `name` and `instance_id` should be specified.
32+
33+
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#zones) in which the DocumentDB instance exists.
34+
35+
- `organization_id` - (Defaults to [provider](../index.md#organization_id) `organization_id`) The ID of the organization the DocumentDB instance is in.
36+
37+
## Attributes Reference
38+
39+
In addition to all above arguments, the following attributes are exported:
40+
41+
- `id` - The ID of the DocumentDB instance.
42+
43+
~> **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`
44+
45+
Exported attributes are the ones from `scaleway_document_db_instance` [resource](../resources/documentdb_instance.md)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
subcategory: "Databases"
3+
page_title: "Scaleway: scaleway_document_db_database"
4+
---
5+
6+
# scaleway_document_db_database
7+
8+
Creates and manages Scaleway DocumentDB database.
9+
For more information, see [the documentation](https://developers.scaleway.com/en/products/rdb/api).
10+
11+
## Examples
12+
13+
### Basic
14+
15+
```hcl
16+
resource "scaleway_document_db_database" "main" {
17+
instance_id = "11111111-1111-1111-1111-111111111111"
18+
name = "my-new-database"
19+
}
20+
```
21+
22+
## Arguments Reference
23+
24+
The following arguments are supported:
25+
26+
- `instance_id` - (Required) UUID of the documentdb instance.
27+
28+
~> **Important:** Updates to `instance_id` will recreate the Database.
29+
30+
- `name` - (Required) Name of the database (e.g. `my-new-database`).
31+
32+
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the resource exists.
33+
34+
## Attributes Reference
35+
36+
In addition to all arguments above, the following attributes are exported:
37+
38+
- `id` - The ID of the database, which is of the form `{region}/{id}/{DBNAME}` e.g. `fr-par/11111111-1111-1111-1111-111111111111/mydb`
39+
- `owner` - The name of the owner of the database.
40+
- `managed` - Whether the database is managed or not.
41+
- `size` - Size in gigabytes of the database.
42+
43+
## Import
44+
45+
DocumentDB Database can be imported using the `{region}/{id}/{DBNAME}`, e.g.
46+
47+
```bash
48+
$ terraform import scaleway_document_db_database.mydb fr-par/11111111-1111-1111-1111-111111111111/mydb
49+
```
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
subcategory: "Databases"
3+
page_title: "Scaleway: scaleway_documentdb_instance"
4+
---
5+
6+
# scaleway_documentdb_instance
7+
8+
Creates and manages Scaleway Database Instances.
9+
For more information, see [the documentation](https://www.scaleway.com/en/developers/api/document_db/).
10+
11+
## Examples
12+
13+
### Example Basic
14+
15+
```hcl
16+
resource "scaleway_documentdb_instance" "main" {
17+
name = "test-documentdb-instance-basic"
18+
node_type = "docdb-play2-pico"
19+
engine = "FerretDB-1"
20+
user_name = "my_initial_user"
21+
password = "thiZ_is_v&ry_s3cret"
22+
tags = ["terraform-test", "scaleway_documentdb_instance", "minimal"]
23+
volume_size_in_gb = 20
24+
}
25+
```
26+
27+
## Arguments Reference
28+
29+
The following arguments are supported:
30+
31+
- `node_type` - (Required) The type of database instance you want to create (e.g. `docdb-play2-pico`).
32+
33+
~> **Important:** Updates to `node_type` will upgrade the Database Instance to the desired `node_type` without any
34+
interruption. Keep in mind that you cannot downgrade a Database Instance.
35+
36+
- `engine` - (Required) Database Instance's engine version (e.g. `FerretDB-1`).
37+
38+
~> **Important:** Updates to `engine` will recreate the Database Instance.
39+
40+
- `volume_type` - (Optional, default to `lssd`) Type of volume where data are stored (`bssd` or `lssd`).
41+
42+
- `volume_size_in_gb` - (Optional) Volume size (in GB) when `volume_type` is set to `bssd`.
43+
44+
- `user_name` - (Optional) Identifier for the first user of the database instance.
45+
46+
~> **Important:** Updates to `user_name` will recreate the Database Instance.
47+
48+
- `password` - (Optional) Password for the first user of the database instance.
49+
50+
- `is_ha_cluster` - (Optional) Enable or disable high availability for the database instance.
51+
52+
- `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).
53+
54+
~> **Important:** Updates to `is_ha_cluster` will recreate the Database Instance.
55+
56+
- `name` - (Optional) The name of the Database Instance.
57+
58+
- `tags` - (Optional) The tags associated with the Database Instance.
59+
60+
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions)
61+
in which the Database Instance should be created.
62+
63+
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the Database
64+
Instance is associated with.
65+
66+
## Attributes Reference
67+
68+
In addition to all arguments above, the following attributes are exported:
69+
70+
- `id` - The ID of the Database Instance.
71+
72+
~> **Important:** Database instances' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they
73+
are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111`
74+
75+
- `organization_id` - The organization ID the Database Instance is associated with.
76+
77+
## Import
78+
79+
Database Instance can be imported using the `{region}/{id}`, e.g.
80+
81+
```bash
82+
$ terraform import scaleway_documentdb_instance.db fr-par/11111111-1111-1111-1111-111111111111
83+
```
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
subcategory: "Databases"
3+
page_title: "Scaleway: scaleway_document_db_private_network_endpoint"
4+
---
5+
6+
# scaleway_document_db_private_network_endpoint
7+
8+
Creates and manages Scaleway Database Private Network Endpoint.
9+
For more information, see [the documentation](https://www.scaleway.com/en/developers/api/document_db/).
10+
11+
## Examples
12+
13+
### Example Basic
14+
15+
```hcl
16+
resource "scaleway_vpc_private_network" "pn" {
17+
name = "my_private_network"
18+
}
19+
20+
resource "scaleway_document_db_private_network_endpoint" "main" {
21+
instance_id = "11111111-1111-1111-1111-111111111111"
22+
private_network {
23+
ip_net = "172.16.32.3/22"
24+
id = scaleway_vpc_private_network.pn.id
25+
}
26+
depends_on = [scaleway_vpc_private_network.pn]
27+
}
28+
```
29+
30+
## Arguments Reference
31+
32+
The following arguments are supported:
33+
34+
- `instance_id` - (Required) UUID of the documentdb instance.
35+
36+
- `ip_net` - (Optional) The IP network address within the private subnet. This must be an IPv4 address with a
37+
CIDR notation. The IP network address within the private subnet is determined by the IP Address Management (IPAM)
38+
service if not set.
39+
40+
- `private_network_id` - (Required) The ID of the private network.
41+
42+
## Private Network
43+
44+
~> **Important:** Updates to `private_network_id` will recreate the attachment Instance.
45+
46+
~> **NOTE:** Please calculate your host IP.
47+
using [cirhost](https://developer.hashicorp.com/terraform/language/functions/cidrhost). Otherwise, lets IPAM service
48+
handle the host IP on the network.
49+
50+
## Attributes Reference
51+
52+
In addition to all arguments above, the following attributes are exported:
53+
54+
- `ip` - IPv4 address on the network.
55+
- `port` - Port in the Private Network.
56+
- `name` - Name of the endpoint.
57+
- `hostname` - Hostname of the endpoint.
58+
59+
60+
~> **Important:** Database instances' IDs are [regional](../guides/regions_and_zones.md#resource-ids), which means they
61+
are of the form `{region}/{id}`, e.g. `fr-par/11111111-1111-1111-1111-111111111111`
62+
63+
## Import
64+
65+
Database Instance Endpoint can be imported using the `{region}/{endpoint_id}`, e.g.
66+
67+
```bash
68+
$ terraform import scaleway_document_db_private_network_endpoint.end fr-par/11111111-1111-1111-1111-111111111111
69+
```
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
subcategory: "Databases"
3+
page_title: "Scaleway: scaleway_document_db_privilege"
4+
---
5+
6+
# scaleway_document_db_privilege
7+
8+
Create and manage Scaleway DocumentDB database privilege.
9+
For more information, see [the documentation](https://www.scaleway.com/en/developers/api/document_db/).
10+
11+
## Example usage
12+
13+
```hcl
14+
resource "scaleway_document_db_privilege" "main" {
15+
instance_id = "11111111-1111-1111-1111-111111111111"
16+
user_name = "my-db-user"
17+
database_name = "my-db-name"
18+
permission = "all"
19+
}
20+
21+
```
22+
23+
## Argument Reference
24+
25+
The following arguments are supported:
26+
27+
- `instance_id` - (Required) UUID of the rdb instance.
28+
29+
- `user_name` - (Required) Name of the user (e.g. `my-db-user`).
30+
31+
- `database_name` - (Required) Name of the database (e.g. `my-db-name`).
32+
33+
- `permission` - (Required) Permission to set. Valid values are `readonly`, `readwrite`, `all`, `custom` and `none`.
34+
35+
- `region` - (Defaults to [provider](../index.md#region) `region`) The [region](../guides/regions_and_zones.md#regions) in which the resource exists.
36+
37+
## Attributes Reference
38+
39+
In addition to all arguments above, the following attributes are exported:
40+
41+
- `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`
42+
43+
## Import
44+
45+
The user privileges can be imported using the `{region}/{instance_id}/{database_name}/{user_name}`, e.g.
46+
47+
```bash
48+
$ terraform import scaleway_document_db_privilege.o fr-par/11111111-1111-1111-1111-111111111111/database_name/foo
49+
```

0 commit comments

Comments
 (0)