CiscoDevNet / terraform-provider-aci

Terraform Cisco ACI provider
https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs
Mozilla Public License 2.0
84 stars 99 forks source link

add_local_user causing a terraform crash #1216

Closed jockgit closed 2 weeks ago

jockgit commented 1 month ago

Terraform Version

PS C:\Users\A-Boyd\Documents\Dev\Terraform\Projects\ACI> terraform -v Terraform v1.8.2 on windows_amd64

APIC version and APIC Platform

APIC-Version 5.2 (8g), APIC-SERVER-L3

Affected Resource(s)

aci_local_user resource

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

Panic Output

aci_local_user.example: Creating... aci_local_user.example: Still creating... [10s elapsed] ╷ │ Error: Plugin did not respond │ │ The plugin encountered an error, and failed to respond to the plugin6.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details. ╵

Stack trace from the terraform-provider-aci_v2.14.0.exe plugin:

panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x10 pc=0x132aeb5]

goroutine 24 [running]: github.com/CiscoDevNet/terraform-provider-aci/v2/aci.tryLogin(0xc000040330?, 0xc0000ea7e0) github.com/CiscoDevNet/terraform-provider-aci/v2/aci/resource_aci_aaauser.go:184 +0x275 github.com/CiscoDevNet/terraform-provider-aci/v2/aci.resourceAciLocalUserCreate({0x1f4e880, 0xc000201030}, 0xc0005b8d80, {0x1d06980?, 0xc0000ea7e0?}) github.com/CiscoDevNet/terraform-provider-aci/v2/aci/resource_aci_aaauser.go:318 +0x56d github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).create(0xc000326000, {0x1f4e7d8, 0xc000538f60}, 0xd?, {0x1d06980, 0xc0000ea7e0}) github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:778 +0x11b github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(Resource).Apply(0xc000326000, {0x1f4e7d8, 0xc000538f60}, 0xc00059a820, 0xc0005b8c00, {0x1d06980, 0xc0000ea7e0}) 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(0xc000008270, {0x1f4e7d8?, 0xc000538990?}, 0xc00058b040) github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:1078 +0xdbc github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ApplyResourceChange({{0x1f55a80?, 0xc000008270?}}, {0x1f4e7d8, 0xc000538990}, 0x0?) github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf5to6server/tf5to6server.go:47 +0x54 github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(muxServer).ApplyResourceChange(0x1f4e810?, {0x1f4e7d8?, 0xc000538690?}, 0xc00058aff0) github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf6muxserver/mux_server_ApplyResourceChange.go:36 +0x193 github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(server).ApplyResourceChange(0xc000258140, {0x1f4e7d8?, 0xc00068bc80?}, 0xc000200770) github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov6/tf6server/server.go:846 +0x3d0 github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x1cd3900?, 0xc000258140}, {0x1f4e7d8, 0xc00068bc80}, 0xc0005b8400, 0x0) github.com/hashicorp/terraform-plugin-go@v0.22.1/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:518 +0x169 google.golang.org/grpc.(Server).processUnaryRPC(0xc00012da00, {0x1f4e7d8, 0xc00068bbf0}, {0x1f545a0, 0xc000059520}, 0xc0000f9560, 0xc000516b70, 0x2955178, 0x0) google.golang.org/grpc@v1.62.1/server.go:1386 +0xe23 google.golang.org/grpc.(Server).handleStream(0xc00012da00, {0x1f545a0, 0xc000059520}, 0xc0000f9560) google.golang.org/grpc@v1.62.1/server.go:1797 +0x100c google.golang.org/grpc.(Server).serveStreams.func2.1() google.golang.org/grpc@v1.62.1/server.go:1027 +0x8b created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 37 google.golang.org/grpc@v1.62.1/server.go:1038 +0x135

Error: The terraform-provider-aci_v2.14.0.exe plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely helpful if you could report the crash with the plugin's maintainers so that it can be fixed. The output above should help diagnose the issue.

Expected Behavior

Local user should be created in APIC

Actual Behaviour

Terraform crash and no user added

Steps to Reproduce

  1. terraform apply (crash occurs on apply)

Important Factoids

References

shrsr commented 1 month ago

@jockgit Thank you for opening this issue. Our team will look into this and get back to you.

akinross commented 1 month ago

Hi @jockgit,

I have been trying to reproduce your error but have not been able to do so yet. Could you provide me a bit more details on how this issue occurred?

  1. Configuration and steps to reproduce
  2. Clean logs of the login calls ( should start from [DEBUG] LocalUser: Beginning Update and needs to include two HTTP Request Method and URL: POST https://173.36.219.190/api/aaaLogin.json )
jockgit commented 1 month ago

Hi!

Many thanks for getting back to me on this. It turns out that it was my mistake in the first place, since I had to configure an HTTP Proxy internally, in order to successfully initialise Terraform under Windows. When running terraform apply I forgot this, and after removing the proxy from the environment variable (since it was only required for the initialisation) I could successfully execute the terraform code.

I allowed the error message to mislead me, as it suggested there was a bug.

Sorry for any effort on your side.

Best regards, Scott

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: Akini Ross @.> Sent: Wednesday, May 15, 2024 10:03:33 AM To: CiscoDevNet/terraform-provider-aci @.> Cc: Scott Boyd @.>; Mention @.> Subject: Re: [CiscoDevNet/terraform-provider-aci] add_local_user causing a terraform crash (Issue #1216)

Hi @jockgithttps://github.com/jockgit,

I have been trying to reproduce your error but have not been able to do so yet. Could you provide me a bit more details on how this issue occurred?

  1. Configuration and steps to reproduce
  2. Clean logs of the login calls ( should start from [DEBUG] LocalUser: Beginning Update and needs to include two HTTP Request Method and URL: POST https://173.36.219.190/api/aaaLogin.json )

— Reply to this email directly, view it on GitHubhttps://github.com/CiscoDevNet/terraform-provider-aci/issues/1216#issuecomment-2111839353, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APVAYVWTGMH6YU2LKJA5BTLZCMJFLAVCNFSM6AAAAABHU7T4ICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJRHAZTSMZVGM. You are receiving this because you were mentioned.Message ID: @.***>

akinross commented 1 month ago

Hi,

No worries thanks for letting us know. Would argue we could still provide a cleaner error message on nil response in the code, assumption was made this would never be nil. Will discuss in the team to decide if we should make a small adjustment here.

jockgit commented 1 month ago

Would make sense, the better and clearer the error code, the less likely unnecessary tickets get raised and the quicker the "stupid" user realises their mistake. 🙈🙈🙈🙈

Sent from Outlook for Androidhttps://aka.ms/AAb9ysg


From: Akini Ross @.> Sent: Wednesday, May 15, 2024 10:47:04 AM To: CiscoDevNet/terraform-provider-aci @.> Cc: Scott Boyd @.>; Mention @.> Subject: Re: [CiscoDevNet/terraform-provider-aci] add_local_user causing a terraform crash (Issue #1216)

Hi,

No worries thanks for letting us know. Would argue we could still provide a cleaner error message on nil response in the code, assumption was made this would never be nil. Will discuss in the team to decide if we should make a small adjustment here.

— Reply to this email directly, view it on GitHubhttps://github.com/CiscoDevNet/terraform-provider-aci/issues/1216#issuecomment-2111925826, or unsubscribehttps://github.com/notifications/unsubscribe-auth/APVAYVVRA7R3RBRI3AHHYFDZCMOIRAVCNFSM6AAAAABHU7T4ICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJRHEZDKOBSGY. You are receiving this because you were mentioned.Message ID: @.***>