Skip to content

Commit

Permalink
[RDS] flavor check hotfix (#2606)
Browse files Browse the repository at this point in the history
[RDS] flavor check hotfix

Summary of the Pull Request
PR Checklist

 Refers to: #2604
 Tests added/passed.
 Documentation updated.
 Schema updated.
 Release notes added.

Acceptance Steps Performed
=== RUN   TestAccRdsInstanceV3Basic
--- PASS: TestAccRdsInstanceV3Basic (865.92s)
PASS

Process finished with the exit code 0

Reviewed-by: Aloento
Reviewed-by: Artem Lifshits
  • Loading branch information
anton-sidelnikov authored Aug 2, 2024
1 parent 8589e32 commit 26c7038
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/resources/rds_instance_v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ The `volume` block supports:

* `type` - (Required, ForceNew) Specifies the volume type. Changing this resize the volume. Its value can be any of the following
and is case-sensitive:
* COMMON: SATA storage (not more available for RDS deployment of new instances).
* COMMON: SATA storage.
* ULTRAHIGH: ultra-high I/O storage.
* CLOUDSSD: cloud SSD storage.
* ESSD: extreme SSD storage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestAccRdsInstanceV3Basic(t *testing.T) {
Config: testAccRdsInstanceV3Basic(postfix),
Check: resource.ComposeTestCheckFunc(
testAccCheckRdsInstanceV3Exists(instanceV3ResourceName, &rdsInstance),
resource.TestCheckResourceAttr(instanceV3ResourceName, "flavor", "rds.pg.c2.large"),
resource.TestCheckResourceAttr(instanceV3ResourceName, "flavor", "rds.pg.c2.medium"),
resource.TestCheckResourceAttr(instanceV3ResourceName, "db.0.port", "8635"),
resource.TestCheckResourceAttr(instanceV3ResourceName, "name", "tf_rds_instance_"+postfix),
resource.TestCheckResourceAttr(instanceV3ResourceName, "db.0.type", "PostgreSQL"),
Expand All @@ -47,7 +47,7 @@ func TestAccRdsInstanceV3Basic(t *testing.T) {
{
Config: testAccRdsInstanceV3Update(postfix),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(instanceV3ResourceName, "flavor", "rds.pg.c2.large"),
resource.TestCheckResourceAttr(instanceV3ResourceName, "flavor", "rds.pg.c2.medium"),
resource.TestCheckResourceAttr(instanceV3ResourceName, "volume.0.size", "100"),
resource.TestCheckResourceAttr(instanceV3ResourceName, "tags.muh", "value-update"),
resource.TestCheckResourceAttr(instanceV3ResourceName, "db.0.port", "8636"),
Expand All @@ -71,7 +71,7 @@ func TestAccRdsPostgre13V3ParamsBasic(t *testing.T) {
Config: testAccRdsPostrgre13V3ParamsBasic(postfix),
Check: resource.ComposeTestCheckFunc(
testAccCheckRdsInstanceV3Exists(instanceV3ResourceName, &rdsInstance),
resource.TestCheckResourceAttr(instanceV3ResourceName, "flavor", "rds.pg.c2.large"),
resource.TestCheckResourceAttr(instanceV3ResourceName, "flavor", "rds.pg.c2.medium"),
resource.TestCheckResourceAttr(instanceV3ResourceName, "db.0.port", "8635"),
resource.TestCheckResourceAttr(instanceV3ResourceName, "name", "tf_rds_instance_"+postfix),
resource.TestCheckResourceAttr(instanceV3ResourceName, "db.0.type", "PostgreSQL"),
Expand All @@ -85,7 +85,7 @@ func TestAccRdsPostgre13V3ParamsBasic(t *testing.T) {
Config: testAccRdsPostrgre13V3ParamsBasicUpdate(postfix),
Check: resource.ComposeTestCheckFunc(
testAccCheckRdsInstanceV3Exists(instanceV3ResourceName, &rdsInstance),
resource.TestCheckResourceAttr(instanceV3ResourceName, "flavor", "rds.pg.c2.large"),
resource.TestCheckResourceAttr(instanceV3ResourceName, "flavor", "rds.pg.c2.medium"),
resource.TestCheckResourceAttr(instanceV3ResourceName, "db.0.port", "8635"),
resource.TestCheckResourceAttr(instanceV3ResourceName, "name", "tf_rds_instance_"+postfix),
resource.TestCheckResourceAttr(instanceV3ResourceName, "db.0.type", "PostgreSQL"),
Expand Down Expand Up @@ -122,7 +122,7 @@ func TestAccRdsInstanceV3RestoreBackup(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckRdsInstanceV3Exists(instanceV3ResourceName, &rdsInstance),
testAccCheckRdsInstanceV3Exists(restoredResourceName, &restoredInstance),
resource.TestCheckResourceAttr(restoredResourceName, "flavor", "rds.pg.c2.large"),
resource.TestCheckResourceAttr(restoredResourceName, "flavor", "rds.pg.c2.medium"),
resource.TestCheckResourceAttr(restoredResourceName, "volume.0.size", "40"),
resource.TestCheckResourceAttr(restoredResourceName, "tags.muh", "value-create"),
resource.TestCheckResourceAttr(instanceV3ResourceName, "lower_case_table_names", "0"),
Expand Down Expand Up @@ -464,7 +464,7 @@ resource "opentelekomcloud_rds_instance_v3" "instance" {
db {
password = "Postgres!120521"
type = "PostgreSQL"
version = "10"
version = "15"
port = "8635"
}
security_group_id = data.opentelekomcloud_networking_secgroup_v2.default_secgroup.id
Expand All @@ -474,7 +474,7 @@ resource "opentelekomcloud_rds_instance_v3" "instance" {
type = "ULTRAHIGH"
size = 40
}
flavor = "rds.pg.c2.large"
flavor = "rds.pg.c2.medium"
backup_strategy {
start_time = "08:00-09:00"
keep_days = 0
Expand Down Expand Up @@ -503,7 +503,7 @@ resource "opentelekomcloud_rds_instance_v3" "instance" {
db {
password = "Postgres!120521"
type = "PostgreSQL"
version = "10"
version = "15"
port = "8636"
}
security_group_id = opentelekomcloud_networking_secgroup_v2.secgroup.id
Expand All @@ -513,7 +513,7 @@ resource "opentelekomcloud_rds_instance_v3" "instance" {
type = "ULTRAHIGH"
size = 100
}
flavor = "rds.pg.c2.large"
flavor = "rds.pg.c2.medium"
backup_strategy {
start_time = "08:00-09:00"
keep_days = 1
Expand Down Expand Up @@ -549,7 +549,7 @@ resource "opentelekomcloud_rds_instance_v3" "instance" {
type = "ULTRAHIGH"
size = 40
}
flavor = "rds.pg.c2.large"
flavor = "rds.pg.c2.medium"
backup_strategy {
start_time = "08:00-09:00"
keep_days = 1
Expand Down Expand Up @@ -960,7 +960,7 @@ resource "opentelekomcloud_rds_instance_v3" "instance" {
type = "ULTRAHIGH"
size = 40
}
flavor = "rds.pg.c2.large"
flavor = "rds.pg.c2.medium"
tags = {
muh = "value-create"
kuh = "value-create"
Expand Down Expand Up @@ -995,7 +995,7 @@ resource "opentelekomcloud_rds_instance_v3" "instance" {
type = "ULTRAHIGH"
size = 40
}
flavor = "rds.pg.c2.large"
flavor = "rds.pg.c2.medium"
tags = {
muh = "value-create"
kuh = "value-create"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func ResourceRdsInstanceV3() *schema.Resource {
},

CustomizeDiff: customdiff.All(
validateRDSv3Flavor("flavor"),
// validateRDSv3Flavor("flavor"),
common.ValidateSubnet("subnet_id"),
common.ValidateVPC("vpc_id"),
),
Expand Down Expand Up @@ -1347,6 +1347,7 @@ func resourceRdsInstanceV3Delete(ctx context.Context, d *schema.ResourceData, me
return nil
}

//nolint:all
func validateRDSv3Flavor(argName string) schema.CustomizeDiffFunc {
return func(ctx context.Context, d *schema.ResourceDiff, meta interface{}) error {
config, ok := meta.(*cfg.Config)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
other:
- |
**[RDS]** Remove ``CustomizeDiff`` for ``flavor`` in ``resource/opentelekomcloud_rds_instance_v3`` (`#2606 <https://github.com/opentelekomcloud/terraform-provider-opentelekomcloud/pull/2606>`_)

0 comments on commit 26c7038

Please sign in to comment.