diff --git a/aws/resource_aws_db_instance.go b/aws/resource_aws_db_instance.go index 60d2d1e3f63..d52e366df39 100644 --- a/aws/resource_aws_db_instance.go +++ b/aws/resource_aws_db_instance.go @@ -818,7 +818,8 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error } if attr, ok := d.GetOk("iops"); ok { - opts.Iops = aws.Int64(int64(attr.(int))) + modifyDbInstanceInput.Iops = aws.Int64(int64(attr.(int))) + requiresModifyDbInstance = true } if attr, ok := d.GetOk("license_model"); ok { @@ -878,7 +879,8 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error } if attr, ok := d.GetOk("storage_type"); ok { - opts.StorageType = aws.String(attr.(string)) + modifyDbInstanceInput.StorageType = aws.String(attr.(string)) + requiresModifyDbInstance = true } if attr, ok := d.GetOk("tde_credential_arn"); ok { diff --git a/aws/resource_aws_db_instance_test.go b/aws/resource_aws_db_instance_test.go index 76f3d56e3da..a47284046db 100644 --- a/aws/resource_aws_db_instance_test.go +++ b/aws/resource_aws_db_instance_test.go @@ -839,6 +839,33 @@ func TestAccAWSDBInstance_SnapshotIdentifier_AllocatedStorage(t *testing.T) { }) } +func TestAccAWSDBInstance_SnapshotIdentifier_Io1Storage(t *testing.T) { + var dbInstance, sourceDbInstance rds.DBInstance + var dbSnapshot rds.DBSnapshot + + rName := acctest.RandomWithPrefix("tf-acc-test") + sourceDbResourceName := "aws_db_instance.source" + snapshotResourceName := "aws_db_snapshot.test" + resourceName := "aws_db_instance.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDBInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSDBInstanceConfig_SnapshotIdentifier_Io1Storage(rName, 1000), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSDBInstanceExists(sourceDbResourceName, &sourceDbInstance), + testAccCheckDbSnapshotExists(snapshotResourceName, &dbSnapshot), + testAccCheckAWSDBInstanceExists(resourceName, &dbInstance), + resource.TestCheckResourceAttr(resourceName, "iops", "1000"), + ), + }, + }, + }) +} + func TestAccAWSDBInstance_SnapshotIdentifier_AutoMinorVersionUpgrade(t *testing.T) { var dbInstance, sourceDbInstance rds.DBInstance var dbSnapshot rds.DBSnapshot @@ -3866,6 +3893,35 @@ resource "aws_db_instance" "test" { `, rName, rName, allocatedStorage, rName) } +func testAccAWSDBInstanceConfig_SnapshotIdentifier_Io1Storage(rName string, iops int) string { + return fmt.Sprintf(` +resource "aws_db_instance" "source" { + allocated_storage = 200 + engine = "mariadb" + identifier = "%s-source" + instance_class = "db.t2.micro" + password = "avoid-plaintext-passwords" + username = "tfacctest" + skip_final_snapshot = true +} + +resource "aws_db_snapshot" "test" { + db_instance_identifier = "${aws_db_instance.source.id}" + db_snapshot_identifier = %q +} + +resource "aws_db_instance" "test" { + identifier = %q + instance_class = "${aws_db_instance.source.instance_class}" + snapshot_identifier = "${aws_db_snapshot.test.id}" + skip_final_snapshot = true + allocated_storage = 200 + iops = %d + storage_type = "io1" +} +`, rName, rName, rName, iops) +} + func testAccAWSDBInstanceConfig_SnapshotIdentifier_AutoMinorVersionUpgrade(rName string, autoMinorVersionUpgrade bool) string { return fmt.Sprintf(` resource "aws_db_instance" "source" {