Skip to content

Commit

Permalink
fix(rdb): support sbs_15k on update (#2599)
Browse files Browse the repository at this point in the history
* fix(rdb): support sbs_15k on update

* update cassette
  • Loading branch information
yfodil authored Jun 4, 2024
1 parent 3451ac3 commit 66a6940
Show file tree
Hide file tree
Showing 4 changed files with 1,726 additions and 310 deletions.
26 changes: 21 additions & 5 deletions docs/resources/rdb_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,30 @@ For more information, see [the documentation](https://www.scaleway.com/en/develo
resource "scaleway_rdb_instance" "main" {
name = "test-rdb"
node_type = "DB-DEV-S"
engine = "PostgreSQL-11"
engine = "PostgreSQL-15"
is_ha_cluster = true
disable_backup = true
user_name = "my_initial_user"
password = "thiZ_is_v&ry_s3cret"
}
```

### Example Block Storage Low Latency

```terraform
resource "scaleway_rdb_instance" "main" {
name = "test-rdb-sbs"
node_type = "db-play2-pico"
engine = "PostgreSQL-15"
is_ha_cluster = true
disable_backup = true
user_name = "my_initial_user"
password = "thiZ_is_v&ry_s3cret"
volume_type = "sbs_15k"
volume_size_in_gb = 10
}
```

### Example with Settings

```terraform
Expand All @@ -49,7 +65,7 @@ resource "scaleway_rdb_instance" "main" {
resource "scaleway_rdb_instance" "main" {
name = "test-rdb"
node_type = "DB-DEV-S"
engine = "PostgreSQL-11"
engine = "PostgreSQL-15"
is_ha_cluster = true
user_name = "my_initial_user"
password = "thiZ_is_v&ry_s3cret"
Expand All @@ -75,7 +91,7 @@ resource "scaleway_vpc_private_network" "pn" {
resource "scaleway_rdb_instance" "main" {
node_type = "db-dev-s"
engine = "PostgreSQL-11"
engine = "PostgreSQL-15"
private_network {
pn_id = scaleway_vpc_private_network.pn.id
ip_net = "172.16.20.4/22" # IP address within a given IP network
Expand All @@ -91,7 +107,7 @@ resource "scaleway_vpc_private_network" "pn" {}
resource "scaleway_rdb_instance" "main" {
node_type = "DB-DEV-S"
engine = "PostgreSQL-11"
engine = "PostgreSQL-15"
private_network {
pn_id = scaleway_vpc_private_network.pn.id
enable_ipam = true
Expand All @@ -105,7 +121,7 @@ resource "scaleway_rdb_instance" "main" {
```terraform
resource "scaleway_rdb_instance" "main" {
node_type = "db-dev-s"
engine = "PostgreSQL-11"
engine = "PostgreSQL-15"
}
```

Expand Down
2 changes: 1 addition & 1 deletion internal/services/rdb/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ func ResourceRdbInstanceUpdate(ctx context.Context, d *schema.ResourceData, m in
// Volume type and size
if d.HasChanges("volume_type", "volume_size_in_gb") {
switch volType {
case rdb.VolumeTypeBssd, rdb.VolumeTypeSbs5k:
case rdb.VolumeTypeBssd, rdb.VolumeTypeSbs5k, rdb.VolumeTypeSbs15k:
if d.HasChange("volume_type") {
upgradeInstanceRequests = append(upgradeInstanceRequests,
rdb.UpgradeInstanceRequest{
Expand Down
22 changes: 22 additions & 0 deletions internal/services/rdb/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,28 @@ func TestAccInstance_SBSVolume(t *testing.T) {
resource.TestCheckResourceAttr("scaleway_rdb_instance.main", "volume_size_in_gb", "20"),
),
},
{
Config: fmt.Sprintf(`
resource scaleway_rdb_instance main {
name = "test-rdb-instance-volume"
node_type = "db-play2-pico"
engine = %q
is_ha_cluster = false
disable_backup = true
user_name = "my_initial_user"
password = "thiZ_is_v&ry_s3cret"
region= "nl-ams"
tags = [ "terraform-test", "scaleway_rdb_instance", "volume" ]
volume_type = "sbs_15k"
volume_size_in_gb = 20
}
`, latestEngineVersion),
Check: resource.ComposeTestCheckFunc(
isInstancePresent(tt, "scaleway_rdb_instance.main"),
resource.TestCheckResourceAttr("scaleway_rdb_instance.main", "volume_type", "sbs_15k"),
resource.TestCheckResourceAttr("scaleway_rdb_instance.main", "volume_size_in_gb", "20"),
),
},
},
})
}
Expand Down
1,986 changes: 1,682 additions & 304 deletions internal/services/rdb/testdata/instance-sbs-volume.cassette.yaml

Large diffs are not rendered by default.

0 comments on commit 66a6940

Please sign in to comment.