Skip to content

Commit ff4ac0d

Browse files
feat(sdb): Add DB instance (#1)
1 parent 391a6b6 commit ff4ac0d

File tree

5 files changed

+72
-4
lines changed

5 files changed

+72
-4
lines changed

README.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,49 @@
22

33
## Purpose
44

5-
This repository is used to manage a <service> on scaleway using terraform.
5+
This repository is used to manage Serverless Databases on scaleway using terraform.
66

77
## Usage
88

99
- Setup the [scaleway provider](https://www.terraform.io/docs/providers/scaleway/index.html) in your tf file.
1010
- Include this module in your tf file. Refer to [documentation](https://www.terraform.io/docs/modules/sources.html#generic-git-repository).
1111

1212
```hcl
13-
module "my_service" {
14-
source = "scaleway-terraform-modules/<module>/scaleway"
15-
version = "0.0.1"
13+
module "sdb" {
14+
source = "scaleway-terraform-modules/sdb/scaleway"
1615
1716
# insert required variables here
1817
}
1918
```
2019

2120
<!-- BEGIN_TF_DOCS -->
21+
## Requirements
2222

23+
| Name | Version |
24+
|------|---------|
25+
| <a name="requirement_terraform"></a> [terraform](#requirement_terraform) | >= 0.13 |
26+
| <a name="requirement_scaleway"></a> [scaleway](#requirement_scaleway) | >= 2.43.0 |
27+
28+
## Resources
29+
30+
| Name | Type |
31+
|------|------|
32+
| [scaleway_sdb_sql_database.main](https://registry.terraform.io/providers/scaleway/scaleway/latest/docs/resources/sdb_sql_database) | resource |
33+
34+
## Inputs
35+
36+
| Name | Description | Type | Default | Required |
37+
|------|-------------|------|---------|:--------:|
38+
| <a name="input_name"></a> [name](#input_name) | Name of the database. | `string` | n/a | yes |
39+
| <a name="input_max_cpu"></a> [max_cpu](#input_max_cpu) | Maximum number of CPU units for your database. | `number` | `15` | no |
40+
| <a name="input_min_cpu"></a> [min_cpu](#input_min_cpu) | Minimum number of CPU units for your database. | `number` | `0` | no |
41+
| <a name="input_region"></a> [region](#input_region) | Region in which the resource exists. | `string` | `null` | no |
42+
43+
## Outputs
44+
45+
| Name | Description |
46+
|------|-------------|
47+
| <a name="output_endpoint"></a> [endpoint](#output_endpoint) | Endpoint of the database. |
2348
<!-- END_TF_DOCS -->
2449

2550
## Authors

main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
resource "scaleway_sdb_sql_database" "main" {
2+
name = var.name
3+
4+
min_cpu = var.min_cpu
5+
max_cpu = var.max_cpu
6+
7+
region = var.region
8+
}

outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "endpoint" {
2+
description = "Endpoint of the database."
3+
value = scaleway_sdb_sql_database.main.endpoint
4+
}

variables.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
variable "name" {
2+
description = "Name of the database."
3+
type = string
4+
}
5+
6+
variable "min_cpu" {
7+
description = "Minimum number of CPU units for your database."
8+
type = number
9+
default = 0
10+
}
11+
12+
variable "max_cpu" {
13+
description = "Maximum number of CPU units for your database."
14+
type = number
15+
default = 15
16+
}
17+
18+
variable "region" {
19+
description = "Region in which the resource exists."
20+
type = string
21+
default = null
22+
}

versions.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
terraform {
2+
required_version = ">= 0.13"
3+
required_providers {
4+
scaleway = {
5+
source = "scaleway/scaleway"
6+
version = ">= 2.43.0"
7+
}
8+
}
9+
}

0 commit comments

Comments
 (0)