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 deref for dataprotection resource #388

Merged
merged 1 commit into from
Mar 21, 2024
Merged

Conversation

rnarenpujari
Copy link
Contributor

@rnarenpujari rnarenpujari commented Mar 20, 2024

  1. What this PR does / why we need it:

Fixes incorrect deref in case the meta field is not set in the dataprotection resource.

Stack trace from the terraform-provider-tanzu-mission-control_v1.4.3 plugin:

panic: runtime error: index out of range [0] with length 0

goroutine 332 [running]:
github.com/vmware/terraform-provider-tanzu-mission-control/internal/resources/dataprotection.resourceEnableDataProtectionRead({0x1f611c0, 0xc00085b650}, 0xc0005b0680, {0x1b57c60?, 0xc000312420})
	github.com/vmware/terraform-provider-tanzu-mission-control/internal/resources/dataprotection/resource_enable_data_protection.go:71 +0x448
github.com/vmware/terraform-provider-tanzu-mission-control/internal/resources/dataprotection.resourceEnableDataProtectionCreate({0x1f61188, 0xc0006a6a20}, 0x19e1d40?, {0x1b57c60?, 0xc000312420?})
	github.com/vmware/terraform-provider-tanzu-mission-control/internal/resources/dataprotection/resource_enable_data_protection.go:56 +0x226
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc000602b60, {0x1f611c0, 0xc0002d8bd0}, 0xd?, {0x1b57c60, 0xc000312420})
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.16.0/helper/schema/resource.go:707 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000602b60, {0x1f611c0, 0xc0002d8bd0}, 0xc0006f48f0, 0xc000169f00, {0x1b57c60, 0xc000312420})
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.16.0/helper/schema/resource.go:837 +0xa85
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0005fc450, {0x1f61118?, 0xc000539600?}, 0xc000828d20)
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.16.0/helper/schema/grpc_provider.go:1021 +0xe8d
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0003d1a40, {0x1f611c0?, 0xc0002d83f0?}, 0xc000641b90)
	github.com/hashicorp/terraform-plugin-go@v0.9.0/tfprotov5/tf5server/server.go:812 +0x515
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1b71ce0?, 0xc0003d1a40}, {0x1f611c0, 0xc0002d83f0}, 0xc000641b20, 0x0)
	github.com/hashicorp/terraform-plugin-go@v0.9.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:385 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0003101e0, {0x1f68098, 0xc0001029c0}, 0xc00094e7e0, 0xc0005ff110, 0x2d54000, 0x0)
	google.golang.org/grpc@v1.56.3/server.go:1335 +0xdf0
google.golang.org/grpc.(*Server).handleStream(0xc0003101e0, {0x1f68098, 0xc0001029c0}, 0xc00094e7e0, 0x0)
	google.golang.org/grpc@v1.56.3/server.go:1712 +0xa2f
google.golang.org/grpc.(*Server).serveStreams.func1.1()
	google.golang.org/grpc@v1.56.3/server.go:947 +0xca
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/grpc@v1.56.3/server.go:958 +0x15c

Error: The terraform-provider-tanzu-mission-control_v1.4.3 plugin crashed!

Acceptance tests passed for the resource:
Screenshot 2024-03-20 at 3 28 40 PM

  1. Which issue(s) this PR fixes

     (optional, in `fixes #<issue number>` format, will close the issue(s) when PR gets merged):
    
     Fixes #
    
  2. Additional information

  3. Special notes for your reviewer

@rnarenpujari rnarenpujari requested a review from eastaga March 20, 2024 10:40
@rnarenpujari rnarenpujari self-assigned this Mar 20, 2024
@vmwclabot
Copy link
Member

@rnarenpujari, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <john.doe@email.org> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.

@vmwclabot vmwclabot added the dco-required DCO Required label Mar 20, 2024
@codecov-commenter
Copy link

codecov-commenter commented Mar 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 25.23%. Comparing base (73e4875) to head (7c1f28d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #388   +/-   ##
=======================================
  Coverage   25.23%   25.23%           
=======================================
  Files         195      195           
  Lines       16908    16908           
=======================================
  Hits         4267     4267           
  Misses      12423    12423           
  Partials      218      218           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vmwclabot vmwclabot removed the dco-required DCO Required label Mar 20, 2024
@eastaga
Copy link

eastaga commented Mar 20, 2024

lgtm

Signed-off-by: Rahul Naren Pujari <rnarenpujari@gmail.com>
@rnarenpujari rnarenpujari merged commit 3681696 into main Mar 21, 2024
4 checks passed
@rnarenpujari
Copy link
Contributor Author

TFTR

@tenthirtyam tenthirtyam deleted the rnarenpujari/dp-fix branch November 13, 2024 06:37
Copy link

I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants