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

PlanResourceChange panic: can't use ElementIterator on null value #1964

Closed
VenelinMartinov opened this issue May 13, 2024 · 5 comments · Fixed by #1971 · May be fixed by pulumi/pulumi-fastly#556
Closed

PlanResourceChange panic: can't use ElementIterator on null value #1964

VenelinMartinov opened this issue May 13, 2024 · 5 comments · Fixed by #1971 · May be fixed by pulumi/pulumi-fastly#556
Assignees
Labels
impact/panic This bug represents a panic or unexpected crash kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@VenelinMartinov
Copy link
Contributor

VenelinMartinov commented May 13, 2024

What happened?

During PlanResourceChange testing, the following error was discovered:

pulumi-fastly paniced during preview on one of the resource with the above error

pulumi/pulumi-fastly#536

Example

+ fastly:index/serviceVcl:ServiceVcl: (create)
          [urn=urn:pulumi:p-it-fv-az1205--service-5df87b39::fastly-service-v1::fastly:index/serviceVcl:ServiceVcl::demo]
          [provider=urn:pulumi:p-it-fv-az1205--service-5df87b39::fastly-service-v1::pulumi:providers:fastly::default_8_8_0_alpha_1715612702_cf498c3::04da6b54-80e4-46f7-96ec-b56ff0331ba9]
          activate       : true
          backends       : [
              [0]: {
                  address            : "127.0.0.1"
                  autoLoadbalance    : false
                  betweenBytesTimeout: 10000
                  connectTimeout     : 1000
                  errorThreshold     : 0
                  firstByteTimeout   : 15000
                  healthcheck        : ""
                  maxConn            : 200
                  maxTlsVersion      : ""
                  minTlsVersion      : ""
                  name               : "localhost"
                  overrideHost       : ""
                  port               : 80
                  requestCondition   : ""
                  shareKey           : ""
                  shield             : ""
                  sslCaCert          : ""
                  sslCertHostname    : ""
                  sslCheckCert       : true
                  sslCiphers         : ""
                  sslClientCert      : [secret]
                  sslClientKey       : [secret]
                  sslSniHostname     : ""
                  useSsl             : false
                  weight             : 100
              }
          ]
          comment        : "Managed by Terraform"
          defaultTtl     : 3600
          domains        : [
              [0]: {
                  comment   : "demo"
                  name      : "demo.pulumi3.io"
              }
          ]
          forceDestroy   : true
          http3          : false
          name           : "demo-842ce34"
          staleIfError   : false
          staleIfErrorTtl: 43200
  panic: can't use ElementIterator on null value
  
  goroutine 41 [running]:
  
  github.com/hashicorp/go-cty/cty.Value.ElementIterator({{{0x16cb9f0?, 0xc00012d4e0?}}, {0x0?, 0x0?}})
  
  	/home/runner/go/pkg/mod/github.com/hashicorp/go-cty@v1.4.1-0.20200414143053-d3edf31b6320/cty/value_ops.go:1038 +0xbe
  
  github.com/hashicorp/go-cty/cty.Value.AsValueSet({{{0x16cb9f0?, 0xc00012d4e0?}}, {0x0?, 0x0?}})
  
  	/home/runner/go/pkg/mod/github.com/hashicorp/go-cty@v1.4.1-0.20200414143053-d3edf31b6320/cty/value_ops.go:1270 +0xed
  
  github.com/fastly/terraform-provider-fastly/fastly.resourceService.validateUniqueNames.func11({0x16cb830?, 0xc0002f2240?}, 0x0?, {0x11cf9a0?, 0xc000124808?})
  
  	/home/runner/work/pulumi-fastly/pulumi-fastly/upstream/fastly/base_fastly_service.go:177 +0x11f
  
  github.com/fastly/terraform-provider-fastly/fastly.resourceService.All.func13({0x16cb830, 0xc0002f2240}, 0x14975ab?, {0x11cf9a0, 0xc000124808})
  
  	/home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20240229143312-4f60ee4e2975/helper/customdiff/compose.go:52 +0xd2
  
  github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0xc000445ce0, {0x16cb830, 0xc0002f2240}, 0xc0007a6ea0, 0xc0005823c0, 0xc00062b460, {0x11cf9a0, 0xc000124808}, 0x0)
  
  	/home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20240229143312-4f60ee4e2975/helper/schema/schema.go:698 +0x4b4
  
  github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff(0x16cba60?, {0x16cb830?, 0xc0002f2240?}, 0xc0007a6ea0, 0x12[93](https://github.com/pulumi/pulumi-fastly/actions/runs/9065253482/job/24906248746?pr=536#step:22:95)ce0?, {0x11cf9a0?, 0xc000124808?})
  
  	/home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20240229143312-4f60ee4e2975/helper/schema/resource.go:967 +0xd5
  
  github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChangeExtra(0xc0006221f8, {0x16cb830?, 0xc0002031d0?}, 0xc0007c1288)
  
  	/home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20240229143312-4f60ee4e2975/helper/schema/grpc_provider.go:831 +0x9b6
  
  github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.(*grpcServer).PlanResourceChange(0xc000125200, {0x16cb830, 0xc0002031d0}, {0x149dfa5, 0x12}, {{0x16cba60?, 0xc00007ef40?}}, {{{0x16cba60, 0xc0001248e8}}, {0x1293ce0, ...}}, ...)
  
  	/home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.82.1-0.20240513144526-3242c866b548/pkg/tfshim/sdk-v2/provider2.go:437 +0x41c
  
  github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.(*planResourceChangeImpl).Diff(0xc000629f80, {0x16cb830, 0xc0002031d0}, {0x149dfa5, 0x12}, {0x0?, 0x0?}, {0x16bd900?, 0xc000582050?}, {0x0, ...})
  
  	/home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.82.1-0.20240513144526-3242c866b548/pkg/tfshim/sdk-v2/provider2.go:159 +0x371
  
  github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.(*providerWithPlanResourceChangeDispatch).Diff(0xc00051fb00, {0x16cb830, 0xc0002031d0}, {0x149dfa5, 0x12}, {0x0, 0x0}, {0x16bd900, 0xc000582050}, {0x0, ...})
  
  	/home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.82.1-0.20240513144526-3242c866b548/pkg/tfshim/sdk-v2/provider2.go:688 +0xe5
  
  github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.(*Provider).Create(0xc000431980, {0x16cb830?, 0xc000202840?}, 0xc000644960)
  
  	/home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.82.1-0.20240513144526-3242c866b548/pkg/tfbridge/provider.go:1096 +0x74e
  
  github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Create_Handler.func1({0x16cb830, 0xc000202840}, {0x13b1080?, 0xc000644960})
  
  	/home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/proto/go/provider_grpc.pb.go:593 +0x72
  
  github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1({0x16cb830, 0xc0002020f0}, {0x13b1080, 0xc000644960}, 0xc00025fe20, 0xc00053c828)
  
  	/home/runner/go/pkg/mod/github.com/grpc-ecosystem/grpc-opentracing@v0.0.0-20180507213350-8e809c8a8645/go/otgrpc/server.go:57 +0x3d0
  
  github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Create_Handler({0x1452d60?, 0xc000431980}, {0x16cb830, 0xc0002020f0}, 0xc00046b380, 0xc0005d6d00)
  
  	/home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.115.2/proto/go/provider_grpc.pb.go:5[95](https://github.com/pulumi/pulumi-fastly/actions/runs/9065253482/job/24906248746?pr=536#step:22:97) +0x135
  
  google.golang.org/grpc.(*Server).processUnaryRPC(0xc000630c00, {0x16cb830, 0xc000202060}, {0x16d5b20, 0xc00028e000}, 0xc0003ef7a0, 0xc0005c7980, 0x20ec380, 0x0)
  
  	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1369 +0xe23
  
  google.golang.org/grpc.(*Server).handleStream(0xc000630c00, {0x16d5b20, 0xc00028e000}, 0xc0003ef7a0)
  
  	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1780 +0x1016
  
  google.golang.org/grpc.(*Server).serveStreams.func2.1()
  
  	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1019 +0x8b
  
  created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 71
  
  	/home/runner/go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1030 +0x135
  
  error: Preview failed: error reading from server: EOF
  error: preview failed
  Resources:
      + 1 to create
  
      command.go:118: Wrote output to /tmp/p-it-fv-az1205--service-5df87b39-19133513[97](https://github.com/pulumi/pulumi-fastly/actions/runs/9065253482/job/24906248746?pr=536#step:22:99)/command-output/pulumi-preview-initial.20240513-155556.12b44.log
      program.go:1461: Destroying stack
      command.go:46: **** Invoke '/usr/local/bin/pulumi destroy --non-interactive --yes --skip-preview' in '/tmp/p-it-fv-az1205--service-5df87b39-1913351397'
      command.go:118: Wrote output to /tmp/p-it-fv-az1205--service-5df87b39-1913351397/command-output/pulumi-destroy.20240513-155556.a60bd.log
      command.go:46: **** Invoke '/usr/local/bin/pulumi stack rm --yes' in '/tmp/p-it-fv-az1205--service-5df87b39-1913351397'
      command.go:118: Wrote output to /tmp/p-it-fv-az1205--service-5df87b39-1913351397/command-output/pulumi-stack-rm.20240513-155556.753f7.log
      program.go:852: 
          	Error Trace:	/home/runner/go/pkg/mod/github.com/pulumi/pulumi/pkg/v3@v3.[115](https://github.com/pulumi/pulumi-fastly/actions/runs/9065253482/job/24906248746?pr=536#step:22:117).2/testing/integration/program.go:852
          	            				/home/runner/work/pulumi-fastly/pulumi-fastly/examples/examples_nodejs_test.go:40
          	Error:      	Received unexpected error:
          	            	running test preview, update, and edits: initial failure: [/usr/local/bin/pulumi preview --non-interactive --diff] did not succeed after 1 tries

Output of pulumi about

.

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@VenelinMartinov VenelinMartinov added needs-triage Needs attention from the triage team kind/bug Some behavior is incorrect or out of spec and removed needs-triage Needs attention from the triage team labels May 13, 2024
@VenelinMartinov VenelinMartinov self-assigned this May 13, 2024
@VenelinMartinov
Copy link
Contributor Author

This seems to bottom out at #1970

@t0yv0
Copy link
Member

t0yv0 commented May 16, 2024

Yes I agree.

fastly.resourceService.validateUniqueNames expects empty set instead of null.

@t0yv0
Copy link
Member

t0yv0 commented May 16, 2024

Can we fix this?

@mikhailshilkov mikhailshilkov added the impact/panic This bug represents a panic or unexpected crash label May 28, 2024
@mikhailshilkov
Copy link
Member

Marked it as impact/panic. I assume it should also be a p1? Or is the panic not hittable by end users?

@VenelinMartinov
Copy link
Contributor Author

This likely does not affect end-users right now as the bridge feature is only rolled out to a few resources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/panic This bug represents a panic or unexpected crash kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
4 participants