-
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
Fix changing engine_version attempts to update resource class #5948
Conversation
Currently when changing a DMS instance, any change to the `engine_version` attempts to update the `ReplicationInstanceClass`
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.
Hi @beny23 👋 Thanks for submitting this!
I was able to write up an acceptance test to cover this behavior and prevent regressions in the future:
func TestAccAWSDmsReplicationInstance_EngineVersion(t *testing.T) {
resourceName := "aws_dms_replication_instance.test"
rName := acctest.RandomWithPrefix("tf-acc-test")
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: dmsReplicationInstanceDestroy,
Steps: []resource.TestStep{
{
Config: testAccAWSDmsReplicationInstanceConfig_EngineVersion(rName, "2.4.2"),
Check: resource.ComposeTestCheckFunc(
checkDmsReplicationInstanceExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "engine_version", "2.4.2"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"apply_immediately"},
},
{
Config: testAccAWSDmsReplicationInstanceConfig_EngineVersion(rName, "2.4.3"),
Check: resource.ComposeTestCheckFunc(
checkDmsReplicationInstanceExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "engine_version", "2.4.3"),
),
},
},
})
}
func testAccAWSDmsReplicationInstanceConfig_EngineVersion(rName, engineVersion string) string {
return fmt.Sprintf(`
resource "aws_dms_replication_instance" "test" {
apply_immediately = true
engine_version = %q
replication_instance_class = "dms.t2.micro"
replication_instance_id = %q
}
`, engineVersion, rName)
}
Running it before your code update:
$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSDmsReplicationInstance_EngineVersion'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSDmsReplicationInstance_EngineVersion -timeout 120m
=== RUN TestAccAWSDmsReplicationInstance_EngineVersion
--- FAIL: TestAccAWSDmsReplicationInstance_EngineVersion (440.26s)
testing.go:527: Step 2 error: Error applying: 1 error occurred:
* aws_dms_replication_instance.test: 1 error occurred:
* aws_dms_replication_instance.test: InvalidParameterValueException: Invalid ReplicationInstance class:2.4.3
status code: 400, request id: 65419ced-bcf8-11e8-88cf-f15605cc1807
FAIL
FAIL github.com/terraform-providers/terraform-provider-aws/aws 441.017s
After your code update, it actually uncovered a new issue:
$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSDmsReplicationInstance_EngineVersion'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSDmsReplicationInstance_EngineVersion -timeout 120m
=== RUN TestAccAWSDmsReplicationInstance_EngineVersion
--- FAIL: TestAccAWSDmsReplicationInstance_EngineVersion (524.21s)
testing.go:527: Step 2 error: Error applying: 1 error occurred:
* aws_dms_replication_instance.test: 1 error occurred:
* aws_dms_replication_instance.test: unexpected state 'upgrading', wanted target 'available'. last error: %!s(<nil>)
FAIL
FAIL github.com/terraform-providers/terraform-provider-aws/aws 524.973s
I added upgrading
as an allowed pending state for ModifyReplicationInstance
, which got everything passing:
$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSDmsReplicationInstance_EngineVersion'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAWSDmsReplicationInstance_EngineVersion -timeout 120m
=== RUN TestAccAWSDmsReplicationInstance_EngineVersion
--- PASS: TestAccAWSDmsReplicationInstance_EngineVersion (603.15s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 603.961s
@bflad thank you!!! |
This has been released in version 1.38.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Currently when changing a DMS instance, any change to the
engine_version
attempts to update theReplicationInstanceClass
Fixes #0000
Changes proposed in this pull request:
engine_version
can be updated.Output from acceptance testing: