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

[Bug]: Provider crashes when "principal" is empty in "aws_ram_principal_association" resource #37320

Closed
xanderbo opened this issue May 7, 2024 · 5 comments · Fixed by #37450
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/ram Issues and PRs that pertain to the ram service.
Milestone

Comments

@xanderbo
Copy link

xanderbo commented May 7, 2024

Terraform Core Version

1.6.0

AWS Provider Version

5.46.0, 5.48.0

Affected Resource(s)

aws_ram_principal_association

Expected Behavior

Display info e.g. "Account ID is missing" or "Principal is empty"

Actual Behavior

Terraform provider crashes.

Relevant Error/Panic Output Snippet

aws_ram_principal_association.target_account: Creating...
╷
│ Error: Plugin did not respond
│ 
│   with aws_ram_principal_association.target_account,
│   on tgw_accounts_connections.tf line 5, in resource "aws_ram_principal_association" "target_account":
│    5: resource "aws_ram_principal_association" "target_account" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
Releasing state lock. This may take a few moments...

Stack trace from the terraform-provider-aws_v5.48.0_x5 plugin:

panic: unexpected format for ID parts ([arn:aws:ram:eu-central-1:381492076950:resource-share/62bb4f05-f7ae-404c-80fa-232b979db9d8 ]), the following id parts indexes are blank ([1])

goroutine 47 [running]:
github.com/hashicorp/terraform-provider-aws/internal/errs.Must[...](...)
	github.com/hashicorp/terraform-provider-aws/internal/errs/must.go:13
github.com/hashicorp/terraform-provider-aws/internal/service/ram.resourcePrincipalAssociationCreate({0x1478aa28, 0xc002c29440}, 0xc000aa4300, {0x1295d200, 0xc0023fe0d0})
	github.com/hashicorp/terraform-provider-aws/internal/service/ram/principal_association.go:70 +0xa45
github.com/hashicorp/terraform-provider-aws/internal/provider.New.(*wrappedResource).Create.interceptedHandler[...].func8(0xc000aa4300?, {0x1295d200?, 0xc0023fe0d0})
	github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:113 +0x283
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x1478aa28?, {0x1478aa28?, 0xc002c28ab0?}, 0xd?, {0x1295d200?, 0xc0023fe0d0?})
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:773 +0x7a
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc0031ead20, {0x1478aa28, 0xc002c28ab0}, 0xc002bb6ea0, 0xc000aa4180, {0x1295d200, 0xc0023fe0d0})
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:909 +0xa89
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc003554720, {0x1478aa28?, 0xc002c289f0?}, 0xc0029af310)
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:1078 +0xd5c
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0xc001989180, {0x1478aa28?, 0xc002c28720?}, 0xc0029af310)
	github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc0005fdcc0, {0x1478aa28?, 0xc002bf9ce0?}, 0xc0000370a0)
	github.com/hashicorp/terraform-plugin-go@v0.22.2/tfprotov5/tf5server/server.go:846 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x12719720, 0xc0005fdcc0}, {0x1478aa28, 0xc002bf9ce0}, 0xc0006f7900, 0x0)
	github.com/hashicorp/terraform-plugin-go@v0.22.2/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x1a6
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0019ba000, {0x1478aa28, 0xc002bf9c50}, {0x147d22f8, 0xc0005a5500}, 0xc002c187e0, 0xc0024a26c0, 0x1d44bb18, 0x0)
	google.golang.org/grpc@v1.63.2/server.go:1369 +0xdf8
google.golang.org/grpc.(*Server).handleStream(0xc0019ba000, {0x147d22f8, 0xc0005a5500}, 0xc002c187e0)
	google.golang.org/grpc@v1.63.2/server.go:1780 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
	google.golang.org/grpc@v1.63.2/server.go:1019 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 27
	google.golang.org/grpc@v1.63.2/server.go:1030 +0x125

Error: The terraform-provider-aws_v5.48.0_x5 plugin crashed!

Terraform Configuration Files

resource "aws_ram_principal_association" "target_account" {
principal = ""
resource_share_arn = aws_ram_resource_share.eu_central_1.arn
}

Steps to Reproduce

just "terraform apply" on problematic code

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

@xanderbo xanderbo added the bug Addresses a defect in current functionality. label May 7, 2024
@github-actions github-actions bot added crash Results from or addresses a Terraform crash or kernel panic. service/ram Issues and PRs that pertain to the ram service. labels May 7, 2024
Copy link

github-actions bot commented May 7, 2024

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label May 7, 2024
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label May 7, 2024
@DanielRieske
Copy link
Contributor

Hi @xanderbo 👋, I'll be happy to pick this up as part of the ram SDKv2 migration.

Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.50.0 milestone May 14, 2024
Copy link

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

Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/ram Issues and PRs that pertain to the ram service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants