pulumi-digitalocean icon indicating copy to clipboard operation
pulumi-digitalocean copied to clipboard

Firewall not updating with new droplet, panic interface conversion

Open NapalmCodes opened this issue 3 years ago • 1 comments

I am attempting with the C# SDK to replace a droplet by specifying a timestamp in the resource name (to force a new server with every deployment). The firewall resource is dependent upon the droplet IP and is throwing a panic error due to the type:

Sample code:

  _ = new DO.Firewall($"{prefix}-Firewall", new DO.FirewallArgs
  {
      DropletIds =
      {
          webServer.Id.Apply(int.Parse)
      }

Error:

Diagnostics:
  pulumi:pulumi:Stack (App-dev):
    panic: interface conversion: interface {} is string, not int
    goroutine 25 [running]:
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.SerializeValueForHash(0xc0008ed120, 0x10850a0, 0x151b210, 0xc00098ea00)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/[email protected]/helper/schema/serialize.go:24 +0x979
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.HashSchema.func1(0x10850a0, 0x151b210, 0xc000b9ae60)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/[email protected]/helper/schema/set.go:43 +0x6f
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.v2Schema.SetHash(0xc00098eb40, 0x10850a0, 0x151b210, 0x0)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/tfshim/sdk-v2/schema.go:176 +0x67
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.visitPropertyValue(0xc000b8b9d4, 0xb, 0xc000926510, 0xa, 0x1067c40, 0xc000835338, 0x15701b8, 0xc00098eb40, 0x0, 0xc00098eb00, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/tfbridge/diff.go:114 +0x495
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.doIgnoreChanges(0x15620f0, 0xc00045bf50, 0xc0009bc450, 0xc00091ce40, 0xc0009bd470, 0x0, 0x0, 0x0, 0x1566718, 0xc000a8eb40)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/tfbridge/diff.go:259 +0x4e5
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.(*Provider).Diff(0xc00082c1e0, 0x1559108, 0xc00091cdb0, 0xc000be02a0, 0xc00082c1e0, 0x10fc201, 0xc0008371c0)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/[email protected]/pkg/tfbridge/provider.go:749 +0x7bd
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Diff_Handler.func1(0x1559108, 0xc00091cdb0, 0x122ffa0, 0xc000be02a0, 0x123e300, 0x1e50020, 0x1559108, 0xc00091cdb0)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/[email protected]/proto/go/provider.pb.go:2251 +0x8d
    github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1(0x1559108, 0xc00091c8a0, 0x122ffa0, 0xc000be02a0, 0xc000709540, 0xc000834030, 0x0, 0x0, 0x1539740, 0xc000462c10)
        /home/runner/go/pkg/mod/github.com/grpc-ecosystem/[email protected]/go/otgrpc/server.go:57 +0x31c
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Diff_Handler(0x1281e60, 0xc00082c1e0, 0x1559108, 0xc00091c8a0, 0xc0005c93e0, 0xc00091a060, 0x1559108, 0xc00091c8a0, 0xc0001c7000, 0x7d1)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/[email protected]/proto/go/provider.pb.go:2253 +0x15e
    google.golang.org/grpc.(*Server).processUnaryRPC(0xc0008861c0, 0x15671f8, 0xc000604480, 0xc0005d4700, 0xc0007861b0, 0x1df8010, 0x0, 0x0, 0x0)
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1210 +0x52b
    google.golang.org/grpc.(*Server).handleStream(0xc0008861c0, 0x15671f8, 0xc000604480, 0xc0005d4700, 0x0)
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1533 +0xd0c
    google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc000450130, 0xc0008861c0, 0x15671f8, 0xc000604480, 0xc0005d4700)
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:871 +0xb2
    created by google.golang.org/grpc.(*Server).serveStreams.func1
        /home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:869 +0x1fd

  digitalocean:index:Firewall (App-Firewall):
    error: transport is closing

This seems to be somehow related to this previous bug I reported, but now presented in a different way: https://github.com/pulumi/pulumi-digitalocean/issues/248

Expected: Firewall to be replaced/updated in place with new droplet IP. Actual: Panic

NapalmCodes avatar Sep 04 '21 01:09 NapalmCodes

I just hit this exact same issue with the Typescript SDK when attempting to redeploy a firewall with a new set of machines replacing an older set. The workaround I found was to rename the firewall as well (effectively deploying a new one).

leonardolang avatar May 17 '22 04:05 leonardolang