terraform-provider-aws icon indicating copy to clipboard operation
terraform-provider-aws copied to clipboard

InvalidParameterValueException when updating aws_dms_replication_task

Open jamesye-canva opened this issue 3 years ago • 4 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.14.11
+ provider registry.terraform.io/hashicorp/aws v3.39.0

The provider version is old, however the same behaviour is present in the code on the main branch as of writing.

Affected Resource(s)

  • aws_dms_replication_task

Terraform Configuration Files

resource "aws_dms_replication_task" "replication_task" {
  migration_type = "full-load"
  replication_instance_arn = aws_dms_replication_instance.replication_instance.replication_instance_arn
  replication_task_id = "my-replication-task"
  replication_task_settings = "<omitted>"
  table_mappings = "<omitted>"
  target_endpoint_arn = aws_dms_endpoint.s3_target.endpoint_arn
  source_endpoint_arn = aws_dms_endpoint.mysql_source.endpoint_arn

  lifecycle {
    ignore_changes = [replication_task_settings]
  }
}

Debug Output

N/A

Panic Output

N/A

Expected Behavior

The resource is updated successfully.

Actual Behavior

The resource fails to update:

Error: InvalidParameterValueException: Error in mapping rules. Rule with ruleId = xyz failed validation. view selection only applies to FULL_LOAD task

Steps to Reproduce

  1. terraform apply
  2. Modify the table_mappings parameter.
  3. terraform apply

Important Factoids

When making the change via the AWS Console, the change is successful. The following parameters are captured in the CloudTrail event for the request made through the console:

{
  "replicationTaskArn": "arn:aws:dms:us-east-1:012345678901:task:ABCDEFGHIJKLMNOPQRSTUVWXYZ",
  "replicationTaskIdentifier": "my-replication-task",
  "migrationType": "full-load",
  "tableMappings": "<omitted>",
  "replicationTaskSettings": "<omitted>",
  "cdcStartPosition": " ",
  "cdcStopPosition": " "
}

The following parameters captured in the request made by Terraform:

{
  "replicationTaskArn": "arn:aws:dms:us-east-1:012345678901:task:ABCDEFGHIJKLMNOPQRSTUVWXYZ",
  "tableMappings": "<omitted>"
}

In the example given, the error appears to be caused by the missing migrationType parameter. The provider currently does not include this parameter if the value has not changed.

The API reference is unclear about the parameters that need to be specified, however from the AWS Console request it appears that at least the migrationType, tableMappings and replicationTaskSettings parameters should be included.

References

jamesye-canva avatar Jun 24 '21 02:06 jamesye-canva

Any workarounds for this so that terraform apply doesn't fail ?

blanco750 avatar Mar 01 '22 13:03 blanco750

Given that the only workaround we can see (correct me if I'm wrong) is to destroy and recreate said resource and the repercussions of that are quite severe, can we get this prioritized accordingly?

It makes it very difficult to use Terraform with DMS resources (and we want to use Terraform because it's mostly excellent :) )

dstockstad avatar May 11 '22 14:05 dstockstad

Agree there with @dstockstad and others. Any way you could prioritize this one? Thanks!

dschiavu avatar May 11 '22 14:05 dschiavu

I made a really basic PR for this bug: https://github.com/hashicorp/terraform-provider-aws/pull/28047

Phlair avatar Nov 28 '22 17:11 Phlair

This functionality has been released in v4.50.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

github-actions[bot] avatar Jan 13 '23 04:01 github-actions[bot]

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Feb 13 '23 02:02 github-actions[bot]