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

Error during pulumi import : Go provider for GCP on Importing routerNat #6569

Open
maikeffi opened this issue Mar 18, 2021 · 1 comment
Open
Labels
area/import kind/bug Some behavior is incorrect or out of spec

Comments

@maikeffi
Copy link

Expected behavior

When trying to import RouterNat of GCP
pulumi import gcp:compute/routerNat:RouterNat

Import Completes successfully and a sample code of the imported resource is expected
But got the error below in

Current behavior

Below is the output log

Pulumi Version: v2.22.0
Go Version: go1.16
Go Compiler: gc
Architecture: amd64
Operating System: darwin
Panic: invalid Go source code:

package main

import (

"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
"github.com/pulumi/pulumi-gcp/sdk/v4/go/gcp/compute"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := compute.NewRouterNat(ctx, "web_stg_nat", &compute.RouterNatArgs{
EnableEndpointIndependentMapping: pulumi.Bool(true),
IcmpIdleTimeoutSec: pulumi.Int(30),
Name: pulumi.String("web-stg-nat"),
NatIpAllocateOption: pulumi.String("MANUAL_ONLY"),
NatIps: interface{}{
nil,
pulumi.String("**************************************"),
},
Router: pulumi.String("web-stg-router"),
SourceSubnetworkIpRangesToNat: pulumi.String("ALL_SUBNETWORKS_ALL_IP_RANGES"),
TcpEstablishedIdleTimeoutSec: pulumi.Int(1200),
TcpTransitoryIdleTimeoutSec: pulumi.Int(30),
UdpIdleTimeoutSec: pulumi.Int(30),
}, pulumi.Protect(true))
if err != nil {
return err
}
return nil
})
}

goroutine 1 [running]:
runtime/debug.Stack(0xc0026caa90, 0x56259e0, 0xc0027daa08)
/usr/local/Cellar/go/1.16/libexec/src/runtime/debug/stack.go:24 +0x9f
main.panicHandler()
/private/tmp/pulumi-20210303-16507-1fj5hzn/pkg/cmd/pulumi/main.go:29 +0x76
panic(0x56259e0, 0xc0027daa08)
/usr/local/Cellar/go/1.16/libexec/src/runtime/panic.go:965 +0x1b9
github.com/pulumi/pulumi/pkg/v2/codegen/go.GenerateProgram(0xc002724640, 0x67b9b18, 0xc00241b200, 0x52fbce0, 0xc0022825b0, 0x1, 0x1)
/private/tmp/pulumi-20210303-16507-1fj5hzn/pkg/codegen/go/gen_program.go:92 +0x91f
main.generateImportedDefinitions.func1(0x5b9cd20, 0xc000b97260, 0xc002724640, 0xc0026cae00, 0x2)
/private/tmp/pulumi-20210303-16507-1fj5hzn/pkg/cmd/pulumi/import.go:238 +0x44
github.com/pulumi/pulumi/pkg/v2/codegen/importer.GenerateLanguageDefinitions(0x5b9cd20, 0xc000b97260, 0x5b9f460, 0xc001b03b90, 0xc0026cb050, 0xc0005e2060, 0x1, 0x1, 0xc000b97290, 0x3e, ...)
/private/tmp/pulumi-20210303-16507-1fj5hzn/pkg/codegen/importer/language.go:107 +0x5e9
main.generateImportedDefinitions(0x5b9cd20, 0xc000b97260, 0xc0008c5890, 0x3, 0xc00045d170, 0x13, 0xc00210acf0, 0x591aa58, 0xc000b97290, 0xc0004fd8c0, ...)
/private/tmp/pulumi-20210303-16507-1fj5hzn/pkg/cmd/pulumi/import.go:237 +0x5a5
main.newImportCmd.func1(0xc000b9f080, 0xc000b97200, 0x3, 0x3, 0x0, 0x0)
/private/tmp/pulumi-20210303-16507-1fj5hzn/pkg/cmd/pulumi/import.go:476 +0xe92
github.com/pulumi/pulumi/sdk/v2/go/common/util/cmdutil.RunResultFunc.func1(0xc000b9f080, 0xc000b97200, 0x3, 0x3)
/private/tmp/pulumi-20210303-16507-1fj5hzn/sdk/go/common/util/cmdutil/exit.go:112 +0x6b
github.com/spf13/cobra.(*Command).execute(0xc000b9f080, 0xc000b971d0, 0x3, 0x3, 0xc000b9f080, 0xc000b971d0)
/Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0xc000158840, 0xc000084740, 0x406dbc8, 0xc000000180)
/Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
/Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
main.main()
/private/tmp/pulumi-20210303-16507-1fj5hzn/pkg/cmd/pulumi/main.go:48 +0x4d

Steps to reproduce

  1. create a go gcp pulumi project
  2. login to gcs to maintain state
  3. run command pulumi import gcp:compute/routerNat:RouterNat <path to gcp nat rounter with name>
  4. Import Completes successfully
  5. above error is encountered when generating sample code .

Context (Environment)

We are trying to set up pulumi for an existing gcp environment .

Affected feature

pulumi import , Code generation

@maikeffi maikeffi added the kind/bug Some behavior is incorrect or out of spec label Mar 18, 2021
@maikeffi maikeffi changed the title Error pulumi Go GCP error on Importing Nat Error pulumi import : Go provider for GCP on Importing routerNat Mar 18, 2021
@maikeffi maikeffi changed the title Error pulumi import : Go provider for GCP on Importing routerNat Error during pulumi import : Go provider for GCP on Importing routerNat Mar 18, 2021
@viveklak viveklak added kind/bug Some behavior is incorrect or out of spec and removed kind/bug Some behavior is incorrect or out of spec labels Mar 18, 2021
@viveklak viveklak self-assigned this Mar 18, 2021
@viveklak viveklak added the impact/panic This bug represents a panic or unexpected crash label Mar 23, 2021
@EvanBoyle EvanBoyle removed the impact/panic This bug represents a panic or unexpected crash label Aug 4, 2021
@EvanBoyle
Copy link
Contributor

Panic fixed via #7265

@EvanBoyle EvanBoyle added the impact/panic This bug represents a panic or unexpected crash label Jul 3, 2023
@justinvp justinvp removed the impact/panic This bug represents a panic or unexpected crash label Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/import kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

5 participants