Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/resources/rdb_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ interruption.

~> **Important** Updates to `engine` will recreate the Database Instance.

- `volume_type` - (Optional, default to `lssd`) Type of volume where data are stored (`bssd`, `lssd`, `sbs_5k` or `sbs_15k`).
- `volume_type` - (Optional, default to `lssd`) Type of volume where data are stored (`lssd`, `sbs_5k` or `sbs_15k`).

- `volume_size_in_gb` - (Optional) Volume size (in GB). Cannot be used when `volume_type` is set to `lssd`.

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/rdb_snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ resource "scaleway_rdb_instance" "main" {
user_name = "my_initial_user"
password = "thiZ_is_v&ry_s3cret"
tags = ["terraform-test", "scaleway_rdb_instance", "minimal"]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10
}

Expand Down
18 changes: 8 additions & 10 deletions internal/services/rdb/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,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, rdb.VolumeTypeSbs15k:
case rdb.VolumeTypeSbs5k, rdb.VolumeTypeSbs15k:
if d.HasChange("volume_type") {
upgradeInstanceRequests = append(upgradeInstanceRequests,
rdb.UpgradeInstanceRequest{
Expand Down Expand Up @@ -710,7 +710,7 @@ func ResourceRdbInstanceUpdate(ctx context.Context, d *schema.ResourceData, m in
case rdb.VolumeTypeLssd:
_, ok := d.GetOk("volume_size_in_gb")
if d.HasChange("volume_size_in_gb") && ok {
return diag.FromErr(fmt.Errorf("volume_size_in_gb should be used with volume_type %s only", rdb.VolumeTypeBssd.String()))
return diag.FromErr(fmt.Errorf("volume_size_in_gb should be used with volume_type %s or %s only", rdb.VolumeTypeSbs5k.String(), rdb.VolumeTypeSbs15k.String()))
}

if d.HasChange("volume_type") {
Expand All @@ -730,21 +730,19 @@ func ResourceRdbInstanceUpdate(ctx context.Context, d *schema.ResourceData, m in
if d.HasChange("node_type") {
// Upgrading the node_type with block storage is not allowed when the disk is full, so if we are in this case,
// we can only allow this action if an increase of the size of the volume is also scheduled before it.
if !diskIsFull || volType == rdb.VolumeTypeLssd || len(upgradeInstanceRequests) > 0 {
if !diskIsFull || len(upgradeInstanceRequests) > 0 {
upgradeInstanceRequests = append(upgradeInstanceRequests,
rdb.UpgradeInstanceRequest{
Region: region,
InstanceID: ID,
NodeType: types.ExpandStringPtr(d.Get("node_type")),
})
} else {
return diag.Diagnostics{
{
Severity: diag.Error,
Summary: "Node type upgrade forbidden when disk is full",
Detail: "You cannot upgrade the node_type of an instance that is using bssd storage once it is in disk_full state. Please increase the volume_size_in_gb first.",
},
}
return diag.Diagnostics{{
Severity: diag.Error,
Summary: "Node type upgrade forbidden when disk is full",
Detail: "You cannot upgrade the node_type of an instance when it is in disk_full state. Please increase the volume_size_in_gb first.",
}}
}
}

Expand Down
34 changes: 17 additions & 17 deletions internal/services/rdb/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func TestAccInstance_PrivateNetworkUpdate(t *testing.T) {
user_name = "my_initial_user"
password = "thiZ_is_v&ry_s3cret"
tags = [ "terraform-test", "scaleway_rdb_instance", "volume", "rdb_pn" ]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10
private_network {
pn_id = "${scaleway_vpc_private_network.pn01.id}"
Expand Down Expand Up @@ -378,7 +378,7 @@ func TestAccInstance_PrivateNetworkUpdate(t *testing.T) {
user_name = "my_initial_user"
password = "thiZ_is_v&ry_s3cret"
tags = [ "terraform-test", "scaleway_rdb_instance", "volume", "rdb_pn" ]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10
private_network {
pn_id = "${scaleway_vpc_private_network.pn02.id}"
Expand Down Expand Up @@ -419,7 +419,7 @@ func TestAccInstance_PrivateNetworkUpdate(t *testing.T) {
user_name = "my_initial_user"
password = "thiZ_is_v&ry_s3cret"
tags = [ "terraform-test", "scaleway_rdb_instance", "volume", "rdb_pn" ]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10`, latestEngineVersion) + `
private_network {
ip_net = format("%s/%s", local.ip_address, local.cidr_prefix)
Expand Down Expand Up @@ -458,7 +458,7 @@ func TestAccInstance_PrivateNetworkUpdate(t *testing.T) {
user_name = "my_initial_user"
password = "thiZ_is_v&ry_s3cret"
tags = [ "terraform-test", "scaleway_rdb_instance", "volume", "rdb_pn" ]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10`, latestEngineVersion) + `
private_network {
ip_net = format("%s/%s", local.ip_address, local.cidr_prefix)
Expand Down Expand Up @@ -490,7 +490,7 @@ func TestAccInstance_PrivateNetworkUpdate(t *testing.T) {
user_name = "my_initial_user"
password = "thiZ_is_v&ry_s3cret"
tags = [ "terraform-test", "scaleway_rdb_instance", "volume", "rdb_pn" ]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10`, latestEngineVersion) + `
private_network {
pn_id = scaleway_vpc_private_network.pn01.id
Expand Down Expand Up @@ -588,7 +588,7 @@ func TestAccInstance_PrivateNetwork(t *testing.T) {
password = "thiZ_is_v&ry_s3cret"
region = "nl-ams"
tags = ["terraform-test", "scaleway_rdb_instance", "volume", "rdb_pn"]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10
private_network {
ip_net = "192.168.1.254/24" #pool high
Expand Down Expand Up @@ -627,7 +627,7 @@ func TestAccInstance_PrivateNetwork(t *testing.T) {
password = "thiZ_is_v&ry_s3cret"
region = "nl-ams"
tags = ["terraform-test", "scaleway_rdb_instance", "volume", "rdb_pn"]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10
}
`, latestEngineVersion),
Expand Down Expand Up @@ -718,13 +718,13 @@ func TestAccInstance_Volume(t *testing.T) {
password = "thiZ_is_v&ry_s3cret"
region= "nl-ams"
tags = [ "terraform-test", "scaleway_rdb_instance", "volume" ]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10
}
`, latestEngineVersion),
Check: resource.ComposeTestCheckFunc(
isInstancePresent(tt, "scaleway_rdb_instance.main"),
resource.TestCheckResourceAttr("scaleway_rdb_instance.main", "volume_type", "bssd"),
resource.TestCheckResourceAttr("scaleway_rdb_instance.main", "volume_type", "sbs_5k"),
resource.TestCheckResourceAttr("scaleway_rdb_instance.main", "volume_size_in_gb", "10"),
),
},
Expand Down Expand Up @@ -855,13 +855,13 @@ func TestAccInstance_ChangeVolumeType(t *testing.T) {
password = "thiZ_is_v&ry_s3cret"
region= "nl-ams"
tags = [ "terraform-test", "scaleway_rdb_instance", "sdb-volume" ]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10
}
`, latestEngineVersion),
Check: resource.ComposeTestCheckFunc(
isInstancePresent(tt, "scaleway_rdb_instance.main"),
resource.TestCheckResourceAttr("scaleway_rdb_instance.main", "volume_type", "bssd"),
resource.TestCheckResourceAttr("scaleway_rdb_instance.main", "volume_type", "sbs_5k"),
resource.TestCheckResourceAttr("scaleway_rdb_instance.main", "volume_size_in_gb", "10"),
),
},
Expand Down Expand Up @@ -915,7 +915,7 @@ func TestAccInstance_ChangeNodeType(t *testing.T) {
password = "thiZ_is_v&ry_s3cret"
region= "nl-ams"
tags = [ "terraform-test", "scaleway_rdb_instance" ]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10
}
`, latestEngineVersion),
Expand All @@ -936,7 +936,7 @@ func TestAccInstance_ChangeNodeType(t *testing.T) {
password = "thiZ_is_v&ry_s3cret"
region= "nl-ams"
tags = [ "terraform-test", "scaleway_rdb_instance"]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10
}
`, latestEngineVersion),
Expand Down Expand Up @@ -1220,7 +1220,7 @@ func TestAccInstance_CompleteWorkflow(t *testing.T) {
user_name = "my_initial_user"
password = "thiZ_is_v&ry_s3cret"
tags = ["terraform-test", "scaleway_rdb_instance"]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10
}

Expand All @@ -1236,7 +1236,7 @@ func TestAccInstance_CompleteWorkflow(t *testing.T) {
is_ha_cluster = false
disable_backup = true
snapshot_id = scaleway_rdb_snapshot.test.id
volume_type = "bssd"
volume_type = "sbs_5k"
tags = ["terraform-test", "restored_instance"]
depends_on = [scaleway_rdb_snapshot.test]
}
Expand All @@ -1260,7 +1260,7 @@ func TestAccInstance_CompleteWorkflow(t *testing.T) {
user_name = "my_initial_user"
password = "thiZ_is_v&ry_s3cret"
tags = ["terraform-test", "scaleway_rdb_instance"]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10
}

Expand All @@ -1276,7 +1276,7 @@ func TestAccInstance_CompleteWorkflow(t *testing.T) {
is_ha_cluster = false
disable_backup = true
snapshot_id = scaleway_rdb_snapshot.test.id
volume_type = "bssd"
volume_type = "sbs_5k"
user_name = "updated_user"
password = "thiZ_is_v&ry_s3cret2"
tags = ["terraform-test", "updated_instance"]
Expand Down
6 changes: 3 additions & 3 deletions internal/services/rdb/snapshots_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestAccRdbSnapshot_Basic(t *testing.T) {
user_name = "my_initial_user"
password = "thiZ_is_v&ry_s3cret"
tags = ["terraform-test", "scaleway_rdb_instance", "minimal"]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10
}

Expand Down Expand Up @@ -77,7 +77,7 @@ func TestAccRdbSnapshot_Update(t *testing.T) {
user_name = "my_initial_user"
password = "thiZ_is_v&ry_s3cret"
tags = ["terraform-test", "scaleway_rdb_instance", "minimal"]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10
}

Expand All @@ -102,7 +102,7 @@ func TestAccRdbSnapshot_Update(t *testing.T) {
user_name = "my_initial_user"
password = "thiZ_is_v&ry_s3cret"
tags = ["terraform-test", "scaleway_rdb_instance", "minimal"]
volume_type = "bssd"
volume_type = "sbs_5k"
volume_size_in_gb = 10
}

Expand Down
918 changes: 410 additions & 508 deletions internal/services/rdb/testdata/instance-change-node-type.cassette.yaml

Large diffs are not rendered by default.

1,596 changes: 307 additions & 1,289 deletions internal/services/rdb/testdata/instance-change-volume-type.cassette.yaml

Large diffs are not rendered by default.

1,765 changes: 662 additions & 1,103 deletions internal/services/rdb/testdata/instance-complete-workflow.cassette.yaml

Large diffs are not rendered by default.

4,562 changes: 0 additions & 4,562 deletions internal/services/rdb/testdata/instance-private-network-dhcp.cassette.yaml

This file was deleted.

2,169 changes: 1,060 additions & 1,109 deletions internal/services/rdb/testdata/instance-private-network-update.cassette.yaml

Large diffs are not rendered by default.

1,749 changes: 948 additions & 801 deletions internal/services/rdb/testdata/instance-private-network.cassette.yaml

Large diffs are not rendered by default.

1,814 changes: 809 additions & 1,005 deletions internal/services/rdb/testdata/instance-volume.cassette.yaml

Large diffs are not rendered by default.

493 changes: 222 additions & 271 deletions internal/services/rdb/testdata/rdb-snapshot-basic.cassette.yaml

Large diffs are not rendered by default.

889 changes: 0 additions & 889 deletions internal/services/rdb/testdata/rdb-snapshot-end-to-end.cassette.yaml

This file was deleted.

622 changes: 311 additions & 311 deletions internal/services/rdb/testdata/rdb-snapshot-update.cassette.yaml

Large diffs are not rendered by default.

Loading