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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic When Creating Elastic IP using Golang #9264

Closed
alexelent-carta opened this issue Mar 16, 2022 · 3 comments
Closed

Panic When Creating Elastic IP using Golang #9264

alexelent-carta opened this issue Mar 16, 2022 · 3 comments
Assignees
Labels
impact/panic This bug represents a panic or unexpected crash kind/bug Some behavior is incorrect or out of spec p1 Bugs severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Milestone

Comments

@alexelent-carta
Copy link

alexelent-carta commented Mar 16, 2022

Hello!

  • 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)

Issue details

When using ec2.NewEip() receiving the following error:

    panic: reflect: Elem of invalid type interface {}
    goroutine 11 [running]:
    reflect.(*rtype).Elem(0x102f2bb20)
    	/opt/homebrew/Cellar/go/1.17.5/libexec/src/reflect/type.go:954 +0x194
    github.com/pulumi/pulumi/sdk/v3/go/pulumi.awaitInputs({0x103166dd8, 0x140001aa008}, {0x1030d1a20, 0x14000530580, 0x16}, {0x102f2bb20, 0x1400056e060, 0x194})
    	/Users/alexelent/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.26.1/go/pulumi/types.go:723 +0xb8c
    github.com/pulumi/pulumi/sdk/v3/go/pulumi.awaitInputs({0x103166dd8, 0x140001aa008}, {0x102f2bb20, 0x14000166b90, 0x194}, {0x102f2bb20, 0x1400056e060, 0x194})
    	/Users/alexelent/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.26.1/go/pulumi/types.go:742 +0x102c
    github.com/pulumi/pulumi/sdk/v3/go/pulumi.awaitInputs({0x103166dd8, 0x140001aa008}, {0x102e9dd00, 0x1400052a408, 0x97}, {0x102e9dd00, 0x1400052a420, 0x197})
    	/Users/alexelent/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.26.1/go/pulumi/types.go:778 +0x1734
    github.com/pulumi/pulumi/sdk/v3/go/pulumi.toOutputTWithContext.func3(0x1400047c100, {0x102e9dd00, 0x1400052a408}, {0x1031712c8, 0x1400052ed20}, {0x103166dd8, 0x140001aa008}, {0x102e9dd00, 0x1400052a420, 0x197}, ...)
    	/Users/alexelent/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.26.1/go/pulumi/types.go:849 +0x118
    created by github.com/pulumi/pulumi/sdk/v3/go/pulumi.toOutputTWithContext
    	/Users/alexelent/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.26.1/go/pulumi/types.go:841 +0x27c
    exit status 2

    error: an unhandled error occurred: program exited with non-zero exit code: 1

Steps to reproduce

Here is the sample code to reproduce:

package main

import (
    "fmt"
    "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
    "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

// See https://www.pulumi.com/docs/intro/concepts/config
type Data struct {
    Name           string
    CidrBlock      string
    Azs            []string
    PrivateSubnets []string
    PublicSubnets  []string
}

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        // Read config from Pulumi-<stack>.yaml
        // See https://www.pulumi.com/docs/intro/concepts/config/#code
        var d Data
        cfg := config.New(ctx, "")
        cfg.RequireObject("data", &d)
        fmt.Printf("VPC name is: %v\n", d.Name)
        fmt.Printf("VPC cidrBlock is: %v\n", d.CidrBlock)

        // Create Elastic IP's for NAT Gateways
        for _, az := range d.Azs{
            eipArgs := &ec2.EipArgs{
                Vpc:  pulumi.Bool(true),
            }

            eips, eipErr := ec2.NewEip(ctx, fmt.Sprintf("%s-natgw-%s", d.Name, az), eipArgs)
            pulumi.Printf("EIPS are: %s\n", eips)
            if eipErr != nil {
                return eipErr
            }
        }

        return nil
    })
}

Here is my config file:

encryptionsalt: v1:REDACTED
config:
  aws:region: us-east-1
  vpc:data:
    name: foo-vpc
    cidrBlock: 192.168.0.0/16
    azs:
      - us-east-1a
      - us-east-1b
      - us-east-1c
    privateSubnets:
      - 192.168.1.0/24
      - 192.168.2.0/24
      - 192.168.3.0/24
    publicSubnets:
      - 192.168.101.0/24
      - 192.168.102.0/24
      - 192.168.103.0/24
$ pulumi version
v3.26.1

Note: For what it is worth, I was able to use an identical code structure/loop with ec2.NewSubnet() and it worked. So appears specific to ec2.NewEip() but I'm not entirely sure.

Expected: EIP creation
Actual: Panic error

@alexelent-carta alexelent-carta added the kind/bug Some behavior is incorrect or out of spec label Mar 16, 2022
@viveklak viveklak added the impact/panic This bug represents a panic or unexpected crash label Mar 22, 2022
@viveklak viveklak transferred this issue from pulumi/pulumi-aws Mar 22, 2022
@Frassle
Copy link
Member

Frassle commented Mar 22, 2022

@iwahbe this might be due to yours or mine recent changes to awaitInputs, I can take a look tomorrow if you don't today

@mikhailshilkov mikhailshilkov added the p1 Bugs severe enough to be the next item assigned to an engineer label Mar 22, 2022
@mikhailshilkov mikhailshilkov added this to the 0.70 milestone Mar 22, 2022
@iwahbe
Copy link
Member

iwahbe commented Mar 22, 2022

#9106 has not merged yet, so I don't think that's the problem. I'll take a look today

@iwahbe
Copy link
Member

iwahbe commented Mar 23, 2022

It looks like #9197 may have fixed the issue. I can reproduce the issue easily (thanks for the great repro info by the way), but it goes away when I use the latest pulumi (built from master). We will cut a release tomorrow. I'll close this issue after we release. Let us know if the issue persists on v3.27.0.

@iwahbe iwahbe closed this as completed Mar 25, 2022
@iwahbe iwahbe added the resolution/fixed This issue was fixed label Mar 25, 2022
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 p1 Bugs severe enough to be the next item assigned to an engineer resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

5 participants