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

r/aws_eks_addon: fix crash when updating pod_identity_association #40168

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

jar-b
Copy link
Member

@jar-b jar-b commented Nov 18, 2024

Description

Previously attempting to update this argument would result in a crash similar to the following:

│ 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.76.0_x5 plugin:

panic: interface conversion: interface {} is *schema.Set, not []interface {}

goroutine 353 [running]:
github.com/hashicorp/terraform-provider-aws/internal/service/eks.resourceAddonUpdate({0x1196189a8, 0x14001bbedb0}, 0x14006991c00, {0x1192eeb60, 0x140003aaa00})
        github.com/hashicorp/terraform-provider-aws/internal/service/eks/addon.go:289 +0xdac
github.com/hashicorp/terraform-provider-aws/internal/provider.New.(*wrappedResource).Update.interceptedHandler[...].func11(0x14006991c00?, {0x1192eeb60?, 0x140003aaa00})
        github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:113 +0x1d8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x1196189a8?, {0x1196189a8?, 0x140019e8ea0?}, 0xd?, {0x1192eeb60?, 0x140003aaa00?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/resource.go:835 +0x64
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x14001899c00, {0x1196189a8, 0x140019e8ea0}, 0x140069c25b0, 0x14006991a80, {0x1192eeb60, 0x140003aaa00})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/resource.go:947 +0x660
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x14002d944b0, {0x1196189a8?, 0x140019e8ae0?}, 0x14004cf2050)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/grpc_provider.go:1155 +0xaa4
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0x14001323a00, {0x1196189a8?, 0x140019e3f20?}, 0x14004cf2050)
        github.com/hashicorp/terraform-plugin-mux@v0.17.0/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x184
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x140021172c0, {0x1196189a8?, 0x140019dd440?}, 0x140069cf7a0)
        github.com/hashicorp/terraform-plugin-go@v0.25.0/tfprotov5/tf5server/server.go:865 +0x2a8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x119186d80, 0x140021172c0}, {0x1196189a8, 0x140019dd440}, 0x14006991700, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.25.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:611 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x1400159d000, {0x1196189a8, 0x140019dd170}, {0x1196985c0, 0x14002fba000}, 0x14003f85440, 0x14002dd7d40, 0x1241083f8, 0x0)
        google.golang.org/grpc@v1.67.1/server.go:1394 +0xb64
google.golang.org/grpc.(*Server).handleStream(0x1400159d000, {0x1196985c0, 0x14002fba000}, 0x14003f85440)
        google.golang.org/grpc@v1.67.1/server.go:1805 +0xb20
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.67.1/server.go:1029 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 52
        google.golang.org/grpc@v1.67.1/server.go:1040 +0x13c

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

Relations

Closes #40165
Relates #39973

References

Output from Acceptance Testing

% make testacc PKG=eks TESTS="TestAccEKSAddon_"
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/eks/... -v -count 1 -parallel 20 -run='TestAccEKSAddon_'  -timeout 360m
2024/11/18 11:11:28 Initializing Terraform AWS Provider...

--- PASS: TestAccEKSAddon_serviceAccountRoleARN (477.59s)
--- PASS: TestAccEKSAddon_preserve (527.40s)
--- PASS: TestAccEKSAddon_basic (541.70s)
--- PASS: TestAccEKSAddon_Disappears_cluster (565.12s)
--- PASS: TestAccEKSAddon_tags (589.28s)
--- PASS: TestAccEKSAddon_podIdentityAssociation (590.06s)
--- PASS: TestAccEKSAddon_addonVersion (623.80s)
--- PASS: TestAccEKSAddon_deprecated (628.77s)
--- PASS: TestAccEKSAddon_resolveConflicts (643.48s)
--- PASS: TestAccEKSAddon_disappears (654.73s)
--- PASS: TestAccEKSAddon_configurationValues (659.61s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/eks        664.703s

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/eks Issues and PRs that pertain to the eks service. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. labels Nov 18, 2024
@jar-b jar-b force-pushed the b-eks_addon-crash branch 2 times, most recently from df1515d to 5a94863 Compare November 18, 2024 16:39
@jar-b jar-b marked this pull request as ready for review November 18, 2024 16:57
@jar-b jar-b requested a review from a team as a code owner November 18, 2024 16:57
@jar-b jar-b marked this pull request as draft November 18, 2024 20:52
@jar-b
Copy link
Member Author

jar-b commented Nov 18, 2024

Moving back into draft - removal of pod_identity_association does not currently function correctly and is under investigation.

Previously attempting to update this argument would result in a crash similar to the following:

```
│ 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.76.0_x5 plugin:

panic: interface conversion: interface {} is *schema.Set, not []interface {}

goroutine 353 [running]:
github.com/hashicorp/terraform-provider-aws/internal/service/eks.resourceAddonUpdate({0x1196189a8, 0x14001bbedb0}, 0x14006991c00, {0x1192eeb60, 0x140003aaa00})
        github.com/hashicorp/terraform-provider-aws/internal/service/eks/addon.go:289 +0xdac
github.com/hashicorp/terraform-provider-aws/internal/provider.New.(*wrappedResource).Update.interceptedHandler[...].func11(0x14006991c00?, {0x1192eeb60?, 0x140003aaa00})
        github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:113 +0x1d8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).update(0x1196189a8?, {0x1196189a8?, 0x140019e8ea0?}, 0xd?, {0x1192eeb60?, 0x140003aaa00?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/resource.go:835 +0x64
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x14001899c00, {0x1196189a8, 0x140019e8ea0}, 0x140069c25b0, 0x14006991a80, {0x1192eeb60, 0x140003aaa00})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/resource.go:947 +0x660
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x14002d944b0, {0x1196189a8?, 0x140019e8ae0?}, 0x14004cf2050)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.35.0/helper/schema/grpc_provider.go:1155 +0xaa4
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0x14001323a00, {0x1196189a8?, 0x140019e3f20?}, 0x14004cf2050)
        github.com/hashicorp/terraform-plugin-mux@v0.17.0/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x184
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x140021172c0, {0x1196189a8?, 0x140019dd440?}, 0x140069cf7a0)
        github.com/hashicorp/terraform-plugin-go@v0.25.0/tfprotov5/tf5server/server.go:865 +0x2a8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x119186d80, 0x140021172c0}, {0x1196189a8, 0x140019dd440}, 0x14006991700, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.25.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:611 +0x1c0
google.golang.org/grpc.(*Server).processUnaryRPC(0x1400159d000, {0x1196189a8, 0x140019dd170}, {0x1196985c0, 0x14002fba000}, 0x14003f85440, 0x14002dd7d40, 0x1241083f8, 0x0)
        google.golang.org/grpc@v1.67.1/server.go:1394 +0xb64
google.golang.org/grpc.(*Server).handleStream(0x1400159d000, {0x1196985c0, 0x14002fba000}, 0x14003f85440)
        google.golang.org/grpc@v1.67.1/server.go:1805 +0xb20
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.67.1/server.go:1029 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 52
        google.golang.org/grpc@v1.67.1/server.go:1040 +0x13c

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

```console
% make testacc PKG=eks TESTS="TestAccEKSAddon_"
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/eks/... -v -count 1 -parallel 20 -run='TestAccEKSAddon_'  -timeout 360m
2024/11/18 11:11:28 Initializing Terraform AWS Provider...

--- PASS: TestAccEKSAddon_serviceAccountRoleARN (477.59s)
--- PASS: TestAccEKSAddon_preserve (527.40s)
--- PASS: TestAccEKSAddon_basic (541.70s)
--- PASS: TestAccEKSAddon_Disappears_cluster (565.12s)
--- PASS: TestAccEKSAddon_tags (589.28s)
--- PASS: TestAccEKSAddon_podIdentityAssociation (590.06s)
--- PASS: TestAccEKSAddon_addonVersion (623.80s)
--- PASS: TestAccEKSAddon_deprecated (628.77s)
--- PASS: TestAccEKSAddon_resolveConflicts (643.48s)
--- PASS: TestAccEKSAddon_disappears (654.73s)
--- PASS: TestAccEKSAddon_configurationValues (659.61s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/eks        664.703s
```
@jar-b jar-b force-pushed the b-eks_addon-crash branch from 5a94863 to 1cfdc41 Compare November 19, 2024 15:33
@jar-b jar-b marked this pull request as ready for review November 19, 2024 15:33
Previously changes to the `pod_identity_association` argument did not properly trigger the update flow, resulting in persistent differences when attempting to add this argument. Additionally, removal of this argument did not send the correct value to the API to trigger deletion of the existing pod identity associations. This changes fixes both scenarios such that additional and removal of this argument should now function as expected.

```console
% make testacc PKG=eks TESTS="TestAccEKSAddon_podIdentityAssociation"
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/eks/... -v -count 1 -parallel 20 -run='TestAccEKSAddon_podIdentityAssociation'  -timeout 360m
2024/11/19 10:00:07 Initializing Terraform AWS Provider...

--- PASS: TestAccEKSAddon_podIdentityAssociation (796.83s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/eks        803.299s
```
@jar-b jar-b force-pushed the b-eks_addon-crash branch from 1cfdc41 to a9939ba Compare November 19, 2024 15:34
@jar-b jar-b added crash Results from or addresses a Terraform crash or kernel panic. bug Addresses a defect in current functionality. labels Nov 19, 2024
Copy link
Member

@YakDriver YakDriver 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 t T=TestAccEKSAddon_ K=eks
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/eks/... -v -count 1 -parallel 20 -run='TestAccEKSAddon_'  -timeout 360m
2024/11/19 13:36:04 Initializing Terraform AWS Provider...
=== RUN   TestAccEKSAddon_basic
=== PAUSE TestAccEKSAddon_basic
=== RUN   TestAccEKSAddon_disappears
=== PAUSE TestAccEKSAddon_disappears
=== RUN   TestAccEKSAddon_Disappears_cluster
=== PAUSE TestAccEKSAddon_Disappears_cluster
=== RUN   TestAccEKSAddon_addonVersion
=== PAUSE TestAccEKSAddon_addonVersion
=== RUN   TestAccEKSAddon_preserve
=== PAUSE TestAccEKSAddon_preserve
=== RUN   TestAccEKSAddon_deprecated
=== PAUSE TestAccEKSAddon_deprecated
=== RUN   TestAccEKSAddon_resolveConflicts
=== PAUSE TestAccEKSAddon_resolveConflicts
=== RUN   TestAccEKSAddon_serviceAccountRoleARN
=== PAUSE TestAccEKSAddon_serviceAccountRoleARN
=== RUN   TestAccEKSAddon_configurationValues
=== PAUSE TestAccEKSAddon_configurationValues
=== RUN   TestAccEKSAddon_podIdentityAssociation
=== PAUSE TestAccEKSAddon_podIdentityAssociation
=== RUN   TestAccEKSAddon_tags
=== PAUSE TestAccEKSAddon_tags
=== CONT  TestAccEKSAddon_basic
=== CONT  TestAccEKSAddon_resolveConflicts
=== CONT  TestAccEKSAddon_tags
=== CONT  TestAccEKSAddon_disappears
=== CONT  TestAccEKSAddon_serviceAccountRoleARN
=== CONT  TestAccEKSAddon_configurationValues
=== CONT  TestAccEKSAddon_podIdentityAssociation
=== CONT  TestAccEKSAddon_addonVersion
=== CONT  TestAccEKSAddon_deprecated
=== CONT  TestAccEKSAddon_preserve
=== CONT  TestAccEKSAddon_Disappears_cluster
--- PASS: TestAccEKSAddon_disappears (523.84s)
--- PASS: TestAccEKSAddon_deprecated (523.93s)
--- PASS: TestAccEKSAddon_addonVersion (539.90s)
--- PASS: TestAccEKSAddon_configurationValues (557.47s)
--- PASS: TestAccEKSAddon_tags (562.79s)
--- PASS: TestAccEKSAddon_resolveConflicts (587.50s)
--- PASS: TestAccEKSAddon_serviceAccountRoleARN (593.51s)
--- PASS: TestAccEKSAddon_Disappears_cluster (630.68s)
--- PASS: TestAccEKSAddon_basic (631.92s)
--- PASS: TestAccEKSAddon_preserve (632.48s)
--- PASS: TestAccEKSAddon_podIdentityAssociation (699.32s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/eks	703.438s

@jar-b jar-b merged commit 1f949d5 into main Nov 19, 2024
49 checks passed
@jar-b jar-b deleted the b-eks_addon-crash branch November 19, 2024 19:38
@github-actions github-actions bot added this to the v5.77.0 milestone Nov 19, 2024
terraform-aws-provider bot pushed a commit that referenced this pull request Nov 19, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Nov 21, 2024
Copy link

This functionality has been released in v5.77.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 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 23, 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/eks Issues and PRs that pertain to the eks service.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: terraform-provider-aws_v5.76.0_x5 plugin crashed for eks_addon
2 participants