-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure required values are set when changing storage_type
.
#28847
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
eb95c0a
Ensure required values are set when changing `storage_type`.
fatmcgav 8d4edab
Merge main
YakDriver 597e802
Fixes after merge, sdkv2
YakDriver d9491e3
Update tests after merge, new ways
YakDriver 0aa73d9
Add changelog
YakDriver fd9e4bb
Add retroactive changelog
YakDriver 6d466f5
Fix misplacing of logic during merge
YakDriver af22811
Clean up tests after merge
YakDriver b3fb095
Remove git merge artifact
YakDriver a223c87
Fix merge artifact
YakDriver c312e22
Remove unused
YakDriver 2d10619
Fix naming
YakDriver 8348019
MySQL/Postgres don't support allocated storage was trying
YakDriver 95e2ed1
Update .changelog/28847.txt
YakDriver 85a8e92
Update .changelog/37257.txt
YakDriver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
resource/aws_db_instance: When changing a `gp3` volume's `allocated_storage` to a value larger than the [threshold value for `engine`](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#gp3-storage), fix bug causing error `InvalidParameterCombination: You must specify both the storage size and iops when modifying the storage size or iops on a DB instance that has iops` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
resource/aws_db_instance: When changing `storage_type` from `io1` or `io2` to `gp3`, fix bug causing error `InvalidParameterCombination: You must specify both the storage size and iops when modifying the storage size or iops on a DB instance that has iops` | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3727,79 +3727,6 @@ func TestAccRDSInstance_MonitoringRoleARN_removedToEnabled(t *testing.T) { | |
}) | ||
} | ||
|
||
// Regression test for https://github.com/hashicorp/terraform/issues/3760 . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are just moved to be near the other storage-related tests |
||
// We apply a plan, then change just the iops. If the apply succeeds, we | ||
// consider this a pass, as before in 3760 the request would fail | ||
func TestAccRDSInstance_Storage_separateIOPSUpdate_Io1(t *testing.T) { | ||
ctx := acctest.Context(t) | ||
if testing.Short() { | ||
t.Skip("skipping long-running test in short mode") | ||
} | ||
|
||
var v types.DBInstance | ||
resourceName := "aws_db_instance.test" | ||
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acctest.PreCheck(ctx, t) }, | ||
ErrorCheck: acctest.ErrorCheck(t, names.RDSServiceID), | ||
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, | ||
CheckDestroy: testAccCheckDBInstanceDestroy(ctx), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccInstanceConfig_iopsUpdate(rName, "io1", 1000), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
testAccCheckInstanceAttributes(&v), | ||
), | ||
}, | ||
|
||
{ | ||
Config: testAccInstanceConfig_iopsUpdate(rName, "io1", 2000), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
testAccCheckInstanceAttributes(&v), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccRDSInstance_Storage_separateIOPSUpdate_Io2(t *testing.T) { | ||
ctx := acctest.Context(t) | ||
if testing.Short() { | ||
t.Skip("skipping long-running test in short mode") | ||
} | ||
|
||
var v types.DBInstance | ||
resourceName := "aws_db_instance.test" | ||
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acctest.PreCheck(ctx, t) }, | ||
ErrorCheck: acctest.ErrorCheck(t, names.RDSServiceID), | ||
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, | ||
CheckDestroy: testAccCheckDBInstanceDestroy(ctx), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccInstanceConfig_iopsUpdate(rName, "io2", 1000), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
testAccCheckInstanceAttributes(&v), | ||
), | ||
}, | ||
|
||
{ | ||
Config: testAccInstanceConfig_iopsUpdate(rName, "io2", 2000), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
testAccCheckInstanceAttributes(&v), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccRDSInstance_portUpdate(t *testing.T) { | ||
ctx := acctest.Context(t) | ||
if testing.Short() { | ||
|
@@ -6126,7 +6053,7 @@ func TestAccRDSInstance_Storage_changeThroughput(t *testing.T) { | |
CheckDestroy: testAccCheckDBInstanceDestroy(ctx), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccInstanceConfig_Storage_throughput(rName, 12000, 500), | ||
Config: testAccInstanceConfig_Storage_iopsThroughputMySQLGP3(rName, 12000, 500), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
resource.TestCheckResourceAttr(resourceName, names.AttrIOPS, "12000"), | ||
|
@@ -6135,7 +6062,7 @@ func TestAccRDSInstance_Storage_changeThroughput(t *testing.T) { | |
), | ||
}, | ||
{ | ||
Config: testAccInstanceConfig_Storage_throughput(rName, 12000, 600), | ||
Config: testAccInstanceConfig_Storage_iopsThroughputMySQLGP3(rName, 12000, 600), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
resource.TestCheckResourceAttr(resourceName, names.AttrIOPS, "12000"), | ||
|
@@ -6165,7 +6092,7 @@ func TestAccRDSInstance_Storage_changeIOPSThroughput(t *testing.T) { | |
CheckDestroy: testAccCheckDBInstanceDestroy(ctx), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccInstanceConfig_Storage_throughput(rName, 12000, 500), | ||
Config: testAccInstanceConfig_Storage_iopsThroughputMySQLGP3(rName, 12000, 500), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
resource.TestCheckResourceAttr(resourceName, names.AttrIOPS, "12000"), | ||
|
@@ -6174,7 +6101,7 @@ func TestAccRDSInstance_Storage_changeIOPSThroughput(t *testing.T) { | |
), | ||
}, | ||
{ | ||
Config: testAccInstanceConfig_Storage_throughput(rName, 13000, 600), | ||
Config: testAccInstanceConfig_Storage_iopsThroughputMySQLGP3(rName, 13000, 600), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
resource.TestCheckResourceAttr(resourceName, names.AttrIOPS, "13000"), | ||
|
@@ -6187,7 +6114,7 @@ func TestAccRDSInstance_Storage_changeIOPSThroughput(t *testing.T) { | |
} | ||
|
||
// https://github.com/hashicorp/terraform-provider-aws/issues/33512 | ||
func TestAccRDSInstance_Storage_changeIOPS(t *testing.T) { | ||
func TestAccRDSInstance_Storage_changeIOPSGP3(t *testing.T) { | ||
ctx := acctest.Context(t) | ||
if testing.Short() { | ||
t.Skip("skipping long-running test in short mode") | ||
|
@@ -6204,7 +6131,7 @@ func TestAccRDSInstance_Storage_changeIOPS(t *testing.T) { | |
CheckDestroy: testAccCheckDBInstanceDestroy(ctx), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccInstanceConfig_Storage_throughput(rName, 12000, 500), | ||
Config: testAccInstanceConfig_Storage_iopsThroughputMySQLGP3(rName, 12000, 500), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
resource.TestCheckResourceAttr(resourceName, names.AttrIOPS, "12000"), | ||
|
@@ -6213,10 +6140,10 @@ func TestAccRDSInstance_Storage_changeIOPS(t *testing.T) { | |
), | ||
}, | ||
{ | ||
Config: testAccInstanceConfig_Storage_throughput(rName, 13000, 500), | ||
Config: testAccInstanceConfig_Storage_iopsThroughputMySQLGP3(rName, 14000, 500), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
resource.TestCheckResourceAttr(resourceName, names.AttrIOPS, "13000"), | ||
resource.TestCheckResourceAttr(resourceName, names.AttrIOPS, "14000"), | ||
resource.TestCheckResourceAttr(resourceName, "storage_throughput", "500"), | ||
resource.TestCheckResourceAttr(resourceName, names.AttrStorageType, "gp3"), | ||
), | ||
|
@@ -6264,7 +6191,7 @@ func TestAccRDSInstance_Storage_throughputSSE(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccRDSInstance_Storage_typePostgres(t *testing.T) { | ||
func TestAccRDSInstance_Storage_postgres(t *testing.T) { | ||
ctx := acctest.Context(t) | ||
if testing.Short() { | ||
t.Skip("skipping long-running test in short mode") | ||
|
@@ -6281,7 +6208,7 @@ func TestAccRDSInstance_Storage_typePostgres(t *testing.T) { | |
CheckDestroy: testAccCheckDBInstanceDestroy(ctx), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccInstanceConfig_Storage_typePostgres(rName, "gp2", 200), | ||
Config: testAccInstanceConfig_Storage_postgres(rName, "gp2", 200), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
resource.TestCheckResourceAttr(resourceName, names.AttrAllocatedStorage, "200"), | ||
|
@@ -6304,7 +6231,7 @@ func TestAccRDSInstance_Storage_typePostgres(t *testing.T) { | |
}, | ||
}, | ||
{ | ||
Config: testAccInstanceConfig_Storage_typePostgres(rName, "gp3", 300), | ||
Config: testAccInstanceConfig_Storage_postgres(rName, "gp3", 300), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
resource.TestCheckResourceAttr(resourceName, names.AttrAllocatedStorage, "300"), | ||
|
@@ -6317,7 +6244,80 @@ func TestAccRDSInstance_Storage_typePostgres(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccRDSInstance_newIdentifier_Pending(t *testing.T) { | ||
// Regression test for https://github.com/hashicorp/terraform/issues/3760 . | ||
// We apply a plan, then change just the iops. If the apply succeeds, we | ||
// consider this a pass, as before in 3760 the request would fail | ||
func TestAccRDSInstance_Storage_changeIOPSio1(t *testing.T) { | ||
ctx := acctest.Context(t) | ||
if testing.Short() { | ||
t.Skip("skipping long-running test in short mode") | ||
} | ||
|
||
var v types.DBInstance | ||
resourceName := "aws_db_instance.test" | ||
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acctest.PreCheck(ctx, t) }, | ||
ErrorCheck: acctest.ErrorCheck(t, names.RDSServiceID), | ||
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, | ||
CheckDestroy: testAccCheckDBInstanceDestroy(ctx), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccInstanceConfig_iopsUpdate(rName, "io1", 1000), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
testAccCheckInstanceAttributes(&v), | ||
), | ||
}, | ||
|
||
{ | ||
Config: testAccInstanceConfig_iopsUpdate(rName, "io1", 2000), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
testAccCheckInstanceAttributes(&v), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccRDSInstance_Storage_changeIOPSio2(t *testing.T) { | ||
ctx := acctest.Context(t) | ||
if testing.Short() { | ||
t.Skip("skipping long-running test in short mode") | ||
} | ||
|
||
var v types.DBInstance | ||
resourceName := "aws_db_instance.test" | ||
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) | ||
|
||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { acctest.PreCheck(ctx, t) }, | ||
ErrorCheck: acctest.ErrorCheck(t, names.RDSServiceID), | ||
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, | ||
CheckDestroy: testAccCheckDBInstanceDestroy(ctx), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccInstanceConfig_iopsUpdate(rName, "io2", 1000), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
testAccCheckInstanceAttributes(&v), | ||
), | ||
}, | ||
|
||
{ | ||
Config: testAccInstanceConfig_iopsUpdate(rName, "io2", 2000), | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
testAccCheckDBInstanceExists(ctx, resourceName, &v), | ||
testAccCheckInstanceAttributes(&v), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccRDSInstance_NewIdentifier_pending(t *testing.T) { | ||
ctx := acctest.Context(t) | ||
if testing.Short() { | ||
t.Skip("skipping long-running test in short mode") | ||
|
@@ -6363,7 +6363,7 @@ func TestAccRDSInstance_newIdentifier_Pending(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestAccRDSInstance_newIdentifier_Immediately(t *testing.T) { | ||
func TestAccRDSInstance_NewIdentifier_immediately(t *testing.T) { | ||
ctx := acctest.Context(t) | ||
if testing.Short() { | ||
t.Skip("skipping long-running test in short mode") | ||
|
@@ -12480,7 +12480,7 @@ resource "aws_db_instance" "test" { | |
`, rName, tfrds.InstanceEngineSQLServerExpress, allocatedStorage)) | ||
} | ||
|
||
func testAccInstanceConfig_Storage_throughput(rName string, iops, throughput int) string { | ||
func testAccInstanceConfig_Storage_iopsThroughputMySQLGP3(rName string, iops, throughput int) string { | ||
return acctest.ConfigCompose( | ||
testAccInstanceConfig_orderableClassMySQLGP3(), | ||
fmt.Sprintf(` | ||
|
@@ -12540,7 +12540,7 @@ resource "aws_db_instance" "test" { | |
`, tfrds.InstanceEngineSQLServerStandard, mainInstanceClasses, rName, iops, throughput) | ||
} | ||
|
||
func testAccInstanceConfig_Storage_typePostgres(rName string, storageType string, allocatedStorage int) string { | ||
func testAccInstanceConfig_Storage_postgres(rName string, storageType string, allocatedStorage int) string { | ||
return fmt.Sprintf(` | ||
data "aws_rds_engine_version" "default" { | ||
engine = %[1]q | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot on a previous PR.