Skip to content
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: aws_dms_replication_task - type assertion to avoid nil pointer panics #41096

Merged
merged 4 commits into from
Jan 28, 2025

Conversation

project0
Copy link
Contributor

@project0 project0 commented Jan 27, 2025

Description

The task setting validation has no proper type assertion what results into broken plan change when the types cannot be converted (or do not match):

  ╷
  │ Error: Request cancelled
  │ 
  │   with module.database_migration_service.aws_dms_replication_task.this["cdc_ex"],
  │   on .terraform/modules/database_migration_service/main.tf line 386, in resource "aws_dms_replication_task" "this":
  │  386: resource "aws_dms_replication_task" "this" {
  │ 
  │ The plugin.(*GRPCProvider).PlanResourceChange request was cancelled.
  ╵
  
  Stack trace from the terraform-provider-aws_v5.84.0_x5 plugin:
  
  panic: interface conversion: interface {} is float64, not string
  
  goroutine 510 [running]:
  github.com/hashicorp/terraform-provider-aws/internal/service/dms.taskSettingsEqual({0x17942720?, 0xc003096680?}, {0x17942ae0?, 0x26d94220?})
  	github.com/hashicorp/terraform-provider-aws/internal/service/dms/task_settings_json.go:66 +0x1e9
  github.com/hashicorp/terraform-provider-aws/internal/service/dms.taskSettingsEqual({0x18187520?, 0xc002fe99b0?}, {0x18187520?, 0xc002fe9b60})
  	github.com/hashicorp/terraform-provider-aws/internal/service/dms/task_settings_json.go:72 +0x26c
  github.com/hashicorp/terraform-provider-aws/internal/service/dms.taskSettingsEqual({0x18187520?, 0xc002fe9980?}, {0x18187520?, 0xc002fe9b30})
  	github.com/hashicorp/terraform-provider-aws/internal/service/dms/task_settings_json.go:72 +0x26c
  github.com/hashicorp/terraform-provider-aws/internal/service/dms.taskSettingsEqual({0x18187520?, 0xc002fe9470?}, {0x18187520?, 0xc002fe9a70})
  	github.com/hashicorp/terraform-provider-aws/internal/service/dms/task_settings_json.go:72 +0x26c
  github.com/hashicorp/terraform-provider-aws/internal/service/dms.suppressEquivalentTaskSettings({0x0?, 0xc002fe9440?}, {0xc002fea000, 0xf51}, {0xc002ff4800, 0x7c4}, 0xc001d49100?)
  	github.com/hashicorp/terraform-provider-aws/internal/service/dms/task_settings_json.go:48 +0x49a
  github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diff(0xc0012f4300, {0x1c54ebe8, 0xc002fe81b0}, {0x1a0cd5ff, 0x19}, 0xc0013b3040, 0xc001d49080, {0x1c5a8800, 0xc001d49100}, 0x0)
  	github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/schema.go:1143 +0x39d
  github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0xc0012f4300, {0x1c54ebe8, 0xc002fe81b0}, 0xc001e744e0, 0xc002f2bb80, 0xc000f4c8e8, {0x19f99500, 0xc000434900}, 0x0)
  	github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/schema.go:678 +0x332
  github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff(0x1c54efa8?, {0x1c54ebe8?, 0xc002fe81b0?}, 0xc001e744e0, 0xc002fe81e0?, {0x19f99500?, 0xc000434900?})
  	github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/resource.go:990 +0xdb
  github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChange(0xc0016405e8, {0x1c54ebe8?, 0xc002fe80c0?}, 0xc002f2b4f0)
  	github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/grpc_provider.go:860 +0xbdf
  github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).PlanResourceChange(0xc00319a880, {0x1c54ebe8?, 0xc002fb9d70?}, 0xc002f2b4f0)
  	github.com/hashicorp/terraform-plugin-mux@v0.17.0/tf5muxserver/mux_server_PlanResourceChange.go:73 +0x2ad
  github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).PlanResourceChange(0xc002027ea0, {0x1c54ebe8?, 0xc002fb9530?}, 0xc001d48d80)
  	github.com/hashicorp/terraform-plugin-go@v0.25.0/tfprotov5/tf5server/server.go:825 +0x3dc
  github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler({0x19e209c0, 0xc002027ea0}, {0x1c54ebe8, 0xc002fb9530}, 0xc001d48d00, 0x0)
  	github.com/hashicorp/terraform-plugin-go@v0.25.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:593 +0x1a6
  google.golang.org/grpc.(*Server).processUnaryRPC(0xc0010d8a00, {0x1c54ebe8, 0xc002fb94a0}, {0x1c5d5d40, 0xc001a064e0}, 0xc002fda120, 0xc001d37d10, 0x27982640, 0x0)
  	google.golang.org/grpc@v1.68.1/server.go:1394 +0xe2b
  google.golang.org/grpc.(*Server).handleStream(0xc0010d8a00, {0x1c5d5d40, 0xc001a064e0}, 0xc002fda120)
  	google.golang.org/grpc@v1.68.1/server.go:1805 +0xe8b
  google.golang.org/grpc.(*Server).serveStreams.func2.1()
  	google.golang.org/grpc@v1.68.1/server.go:1029 +0x7f
  created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 59
  	google.golang.org/grpc@v1.68.1/server.go:1040 +0x125
  
  Error: The terraform-provider-aws_v5.84.0_x5 plugin crashed!

Relations

References

Output from Acceptance Testing

% make testacc TESTS=TestAccXXX PKG=ec2

...

@project0 project0 requested a review from a team as a code owner January 27, 2025 12:53
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added service/dms Issues and PRs that pertain to the dms service. needs-triage Waiting for first response or review from a maintainer. labels Jan 27, 2025
@project0
Copy link
Contributor Author

project0 commented Jan 27, 2025

I thought its the same problem as #36588, but i think this is another problem (or the code changed too much so the original stack trace is outdated)

@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 27, 2025
@project0 project0 force-pushed the fix/dms-task-nil-pointer branch from f3b2994 to 2e04b7f Compare January 27, 2025 21:01
@ewbankkit ewbankkit self-assigned this Jan 28, 2025
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Jan 28, 2025
@ewbankkit ewbankkit added the crash Results from or addresses a Terraform crash or kernel panic. label Jan 28, 2025
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccDMSReplicationConfig_' PKG=dms ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/dms/... -v -count 1 -parallel 3  -run=TestAccDMSReplicationConfig_ -timeout 360m -vet=off
2025/01/28 08:32:47 Initializing Terraform AWS Provider...
=== RUN   TestAccDMSReplicationConfig_tags
=== PAUSE TestAccDMSReplicationConfig_tags
=== RUN   TestAccDMSReplicationConfig_tags_null
=== PAUSE TestAccDMSReplicationConfig_tags_null
=== RUN   TestAccDMSReplicationConfig_tags_EmptyMap
=== PAUSE TestAccDMSReplicationConfig_tags_EmptyMap
=== RUN   TestAccDMSReplicationConfig_tags_AddOnUpdate
=== PAUSE TestAccDMSReplicationConfig_tags_AddOnUpdate
=== RUN   TestAccDMSReplicationConfig_tags_EmptyTag_OnCreate
=== PAUSE TestAccDMSReplicationConfig_tags_EmptyTag_OnCreate
=== RUN   TestAccDMSReplicationConfig_tags_EmptyTag_OnUpdate_Add
=== PAUSE TestAccDMSReplicationConfig_tags_EmptyTag_OnUpdate_Add
=== RUN   TestAccDMSReplicationConfig_tags_EmptyTag_OnUpdate_Replace
=== PAUSE TestAccDMSReplicationConfig_tags_EmptyTag_OnUpdate_Replace
=== RUN   TestAccDMSReplicationConfig_tags_DefaultTags_providerOnly
=== PAUSE TestAccDMSReplicationConfig_tags_DefaultTags_providerOnly
=== RUN   TestAccDMSReplicationConfig_tags_DefaultTags_nonOverlapping
=== PAUSE TestAccDMSReplicationConfig_tags_DefaultTags_nonOverlapping
=== RUN   TestAccDMSReplicationConfig_tags_DefaultTags_overlapping
=== PAUSE TestAccDMSReplicationConfig_tags_DefaultTags_overlapping
=== RUN   TestAccDMSReplicationConfig_tags_DefaultTags_updateToProviderOnly
=== PAUSE TestAccDMSReplicationConfig_tags_DefaultTags_updateToProviderOnly
=== RUN   TestAccDMSReplicationConfig_tags_DefaultTags_updateToResourceOnly
=== PAUSE TestAccDMSReplicationConfig_tags_DefaultTags_updateToResourceOnly
=== RUN   TestAccDMSReplicationConfig_tags_DefaultTags_emptyResourceTag
=== PAUSE TestAccDMSReplicationConfig_tags_DefaultTags_emptyResourceTag
=== RUN   TestAccDMSReplicationConfig_tags_DefaultTags_emptyProviderOnlyTag
=== PAUSE TestAccDMSReplicationConfig_tags_DefaultTags_emptyProviderOnlyTag
=== RUN   TestAccDMSReplicationConfig_tags_DefaultTags_nullOverlappingResourceTag
=== PAUSE TestAccDMSReplicationConfig_tags_DefaultTags_nullOverlappingResourceTag
=== RUN   TestAccDMSReplicationConfig_tags_DefaultTags_nullNonOverlappingResourceTag
=== PAUSE TestAccDMSReplicationConfig_tags_DefaultTags_nullNonOverlappingResourceTag
=== RUN   TestAccDMSReplicationConfig_tags_ComputedTag_OnCreate
=== PAUSE TestAccDMSReplicationConfig_tags_ComputedTag_OnCreate
=== RUN   TestAccDMSReplicationConfig_tags_ComputedTag_OnUpdate_Add
=== PAUSE TestAccDMSReplicationConfig_tags_ComputedTag_OnUpdate_Add
=== RUN   TestAccDMSReplicationConfig_tags_ComputedTag_OnUpdate_Replace
=== PAUSE TestAccDMSReplicationConfig_tags_ComputedTag_OnUpdate_Replace
=== RUN   TestAccDMSReplicationConfig_tags_IgnoreTags_Overlap_DefaultTag
=== PAUSE TestAccDMSReplicationConfig_tags_IgnoreTags_Overlap_DefaultTag
=== RUN   TestAccDMSReplicationConfig_tags_IgnoreTags_Overlap_ResourceTag
=== PAUSE TestAccDMSReplicationConfig_tags_IgnoreTags_Overlap_ResourceTag
=== RUN   TestAccDMSReplicationConfig_basic
=== PAUSE TestAccDMSReplicationConfig_basic
=== RUN   TestAccDMSReplicationConfig_disappears
=== PAUSE TestAccDMSReplicationConfig_disappears
=== RUN   TestAccDMSReplicationConfig_settings_EnableLogging
=== PAUSE TestAccDMSReplicationConfig_settings_EnableLogging
=== RUN   TestAccDMSReplicationConfig_settings_LoggingValidation
=== PAUSE TestAccDMSReplicationConfig_settings_LoggingValidation
=== RUN   TestAccDMSReplicationConfig_settings_LogComponents
=== PAUSE TestAccDMSReplicationConfig_settings_LogComponents
=== RUN   TestAccDMSReplicationConfig_settings_StreamBuffer
=== PAUSE TestAccDMSReplicationConfig_settings_StreamBuffer
=== RUN   TestAccDMSReplicationConfig_update
=== PAUSE TestAccDMSReplicationConfig_update
=== RUN   TestAccDMSReplicationConfig_startReplication
=== PAUSE TestAccDMSReplicationConfig_startReplication
=== CONT  TestAccDMSReplicationConfig_tags
=== CONT  TestAccDMSReplicationConfig_tags_DefaultTags_nullNonOverlappingResourceTag
=== CONT  TestAccDMSReplicationConfig_disappears
--- PASS: TestAccDMSReplicationConfig_disappears (58.16s)
=== CONT  TestAccDMSReplicationConfig_startReplication
--- PASS: TestAccDMSReplicationConfig_tags_DefaultTags_nullNonOverlappingResourceTag (68.42s)
=== CONT  TestAccDMSReplicationConfig_update
--- PASS: TestAccDMSReplicationConfig_tags (109.96s)
=== CONT  TestAccDMSReplicationConfig_settings_StreamBuffer
--- PASS: TestAccDMSReplicationConfig_update (75.31s)
=== CONT  TestAccDMSReplicationConfig_settings_LogComponents
--- PASS: TestAccDMSReplicationConfig_settings_StreamBuffer (65.87s)
=== CONT  TestAccDMSReplicationConfig_settings_EnableLogging
--- PASS: TestAccDMSReplicationConfig_settings_LogComponents (59.61s)
=== CONT  TestAccDMSReplicationConfig_tags_IgnoreTags_Overlap_DefaultTag
--- PASS: TestAccDMSReplicationConfig_settings_EnableLogging (90.57s)
=== CONT  TestAccDMSReplicationConfig_basic
=== RUN   TestAccDMSReplicationConfig_basic/full-load
=== PAUSE TestAccDMSReplicationConfig_basic/full-load
=== RUN   TestAccDMSReplicationConfig_basic/cdc
=== PAUSE TestAccDMSReplicationConfig_basic/cdc
=== RUN   TestAccDMSReplicationConfig_basic/full-load-and-cdc
=== PAUSE TestAccDMSReplicationConfig_basic/full-load-and-cdc
=== CONT  TestAccDMSReplicationConfig_tags_IgnoreTags_Overlap_ResourceTag
--- PASS: TestAccDMSReplicationConfig_tags_IgnoreTags_Overlap_DefaultTag (99.90s)
=== CONT  TestAccDMSReplicationConfig_tags_ComputedTag_OnUpdate_Add
--- PASS: TestAccDMSReplicationConfig_tags_IgnoreTags_Overlap_ResourceTag (98.44s)
=== CONT  TestAccDMSReplicationConfig_tags_ComputedTag_OnUpdate_Replace
--- PASS: TestAccDMSReplicationConfig_tags_ComputedTag_OnUpdate_Add (84.93s)
=== CONT  TestAccDMSReplicationConfig_tags_ComputedTag_OnCreate
--- PASS: TestAccDMSReplicationConfig_tags_ComputedTag_OnUpdate_Replace (74.43s)
=== CONT  TestAccDMSReplicationConfig_tags_DefaultTags_nonOverlapping
--- PASS: TestAccDMSReplicationConfig_tags_ComputedTag_OnCreate (63.17s)
=== CONT  TestAccDMSReplicationConfig_tags_DefaultTags_nullOverlappingResourceTag
--- PASS: TestAccDMSReplicationConfig_tags_DefaultTags_nullOverlappingResourceTag (67.54s)
=== CONT  TestAccDMSReplicationConfig_tags_DefaultTags_emptyProviderOnlyTag
--- PASS: TestAccDMSReplicationConfig_tags_DefaultTags_nonOverlapping (98.85s)
=== CONT  TestAccDMSReplicationConfig_tags_DefaultTags_emptyResourceTag
--- PASS: TestAccDMSReplicationConfig_tags_DefaultTags_emptyProviderOnlyTag (61.08s)
=== CONT  TestAccDMSReplicationConfig_tags_DefaultTags_updateToResourceOnly
=== CONT  TestAccDMSReplicationConfig_settings_LoggingValidation
--- PASS: TestAccDMSReplicationConfig_tags_DefaultTags_emptyResourceTag (67.29s)
--- PASS: TestAccDMSReplicationConfig_settings_LoggingValidation (1.82s)
=== CONT  TestAccDMSReplicationConfig_tags_DefaultTags_updateToProviderOnly
--- PASS: TestAccDMSReplicationConfig_tags_DefaultTags_updateToResourceOnly (75.87s)
=== CONT  TestAccDMSReplicationConfig_tags_DefaultTags_overlapping
--- PASS: TestAccDMSReplicationConfig_tags_DefaultTags_updateToProviderOnly (92.97s)
=== CONT  TestAccDMSReplicationConfig_tags_EmptyTag_OnCreate
--- PASS: TestAccDMSReplicationConfig_tags_DefaultTags_overlapping (110.52s)
=== CONT  TestAccDMSReplicationConfig_tags_EmptyMap
--- PASS: TestAccDMSReplicationConfig_tags_EmptyTag_OnCreate (75.97s)
=== CONT  TestAccDMSReplicationConfig_tags_DefaultTags_providerOnly
--- PASS: TestAccDMSReplicationConfig_tags_EmptyMap (72.71s)
=== CONT  TestAccDMSReplicationConfig_tags_AddOnUpdate
--- PASS: TestAccDMSReplicationConfig_tags_DefaultTags_providerOnly (123.70s)
=== CONT  TestAccDMSReplicationConfig_tags_EmptyTag_OnUpdate_Replace
--- PASS: TestAccDMSReplicationConfig_tags_AddOnUpdate (80.55s)
=== CONT  TestAccDMSReplicationConfig_tags_null
--- PASS: TestAccDMSReplicationConfig_tags_EmptyTag_OnUpdate_Replace (82.57s)
=== CONT  TestAccDMSReplicationConfig_tags_EmptyTag_OnUpdate_Add
--- PASS: TestAccDMSReplicationConfig_tags_null (71.88s)
=== CONT  TestAccDMSReplicationConfig_basic/full-load
=== CONT  TestAccDMSReplicationConfig_basic/full-load-and-cdc
--- PASS: TestAccDMSReplicationConfig_tags_EmptyTag_OnUpdate_Add (95.84s)
=== CONT  TestAccDMSReplicationConfig_basic/cdc
--- PASS: TestAccDMSReplicationConfig_basic (0.00s)
    --- PASS: TestAccDMSReplicationConfig_basic/full-load (65.58s)
    --- PASS: TestAccDMSReplicationConfig_basic/full-load-and-cdc (60.13s)
    --- PASS: TestAccDMSReplicationConfig_basic/cdc (57.50s)
--- PASS: TestAccDMSReplicationConfig_startReplication (3288.81s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/dms	3352.264s

Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@ewbankkit
Copy link
Contributor

@project0 Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 786bf48 into hashicorp:main Jan 28, 2025
44 checks passed
@github-actions github-actions bot added this to the v5.85.0 milestone Jan 28, 2025
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Feb 3, 2025
Copy link

github-actions bot commented Feb 3, 2025

This functionality has been released in v5.85.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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/dms Issues and PRs that pertain to the dms service.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants