pulumi / pulumi-aws-iam

A Pulumi Multi Language Component for working with AWS IAM resources.
Apache License 2.0
6 stars 5 forks source link

Python RoleForServiceAccountsEks - Go panic: runtime error: invalid memory address or nil pointer dereference #4

Closed danielaptekman closed 1 year ago

danielaptekman commented 1 year ago

What happened?

Trying to create a RoleForServiceAccountsEks for Karpenter

Steps to reproduce

My Python code:

iam_new.RoleForServiceAccountsEks( 'role_for_service_account_eks', role=iam_new.RoleArgs( name='karpenter' ), tags={ 'Name': 'karpenter-irsa', }, oidc_providers={ 'main': iam_new.OIDCProviderArgs( provider_arn='arn:aws:iam::00000000000:oidc-provider/oidc.eks.us-east-1.amazonaws.com/id/', namespace_service_accounts=['karpenter:karpenter'], ), }, policies=iam_new.EKSRolePoliciesArgs( karpenter_controller=iam_new.EKSKarpenterControllerPolicyArgs( attach=True, cluster_id=eks_cluster_id ), ), )

Expected Behavior

Role should be created

Actual Behavior

Got the following error during pulumi up:

error: Resource monitor has terminated, shutting down error: an unhandled error occurred: Program exited with non-zero exit code: 1

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x20 pc=0x10307381c]
goroutine 38 [running]:
github.com/pulumi/pulumi-aws-iam/pkg/eks_policies.AttachKarpenterControllerPolicy(0x140003e0000, 0x1?, {0x140000420dc, 0x3}, {0x140003980c0, 0xc}, {0x1, {0x1034751b0, 0x14000462230}, {0x14000442138, ...}, ...})
    /home/runner/work/pulumi-aws-iam/pulumi-aws-iam/provider/pkg/eks_policies/karpenter_controller.go:53 +0x3c
github.com/pulumi/pulumi-aws-iam/pkg/provider.NewRoleForServiceAccountsEks(0x140003e0000, {0x14000422180, 0x1c}, 0x140001ee240, {0x14000404cc0?, 0x1, 0x1})
    /home/runner/work/pulumi-aws-iam/pulumi-aws-iam/provider/pkg/provider/role_for_service_account_eks.go:282 +0x92c
github.com/pulumi/pulumi-aws-iam/pkg/provider.createNewResourceConstructor[...].func1({0x14000422180?, 0x1c}, {0x140003e0000, 0x1400040fd10?}, {0x1034696b8?, 0x1400041a1e0?})
    /home/runner/work/pulumi-aws-iam/pulumi-aws-iam/provider/pkg/provider/provider.go:51 +0xec
github.com/pulumi/pulumi-aws-iam/pkg/provider.construct(0x14000078900?, {0x14000402180, 0x27}, {0x14000422180, 0x1c}, {0x140003e0000?, 0x1400040fd10?}, {0x1034696b8, 0x1400041a1e0})
    /home/runner/work/pulumi-aws-iam/pulumi-aws-iam/provider/pkg/provider/provider.go:67 +0xa0
github.com/pulumi/pulumi/sdk/v3/go/pulumi/provider.Construct.func1(0x140003e0000?, {0x14000402180?, 0x49?}, {0x14000422180?, 0x14000400100?}, 0x14000414c40?, {0x1034696b8?, 0x1400041a1e0?})
    /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.33.2/go/pulumi/provider/provider.go:38 +0x48
github.com/pulumi/pulumi/sdk/v3/go/pulumi.construct({0x10346fe18, 0x1400040f560}, 0x1400041e100, 0x1033334c0?, 0x14000404e60)
    /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.33.2/go/pulumi/provider.go:120 +0x728
github.com/pulumi/pulumi/sdk/v3/go/pulumi/provider.linkedConstruct({0x10346fe18?, 0x1400040f560?}, 0x30?, 0x1033a9440?, 0x1400016b818?)
    /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.33.2/go/pulumi/provider_linked.go:34 +0x28
github.com/pulumi/pulumi/sdk/v3/go/pulumi/provider.Construct({0x10346fe18, 0x1400040f560}, 0x1033b8f20?, 0x1033f4ec0?, 0x10345ddb0)
    /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.33.2/go/pulumi/provider/provider.go:35 +0x88
github.com/pulumi/pulumi/pkg/v3/resource/provider.(*componentProvider).Construct(0x1400016b848?, {0x10346fe18?, 0x1400040f560?}, 0x103293600?)
    /home/runner/go/pkg/mod/github.com/pulumi/pulumi/pkg/v3@v3.33.2/resource/provider/component_provider.go:114 +0x12c
github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Construct_Handler.func1({0x10346fe18, 0x1400040f560}, {0x10342b8c0?, 0x1400041e100})
    /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.33.2/proto/go/provider.pb.go:2694 +0x78
github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1({0x10346fe18, 0x1400040e570}, {0x10342b8c0, 0x1400041e100}, 0x1400040a340, 0x14000418330)
    /home/runner/go/pkg/mod/github.com/grpc-ecosystem/grpc-opentracing@v0.0.0-20180507213350-8e809c8a8645/go/otgrpc/server.go:57 +0x310
github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Construct_Handler({0x1033f4ec0?, 0x14000115ef0}, {0x10346fe18, 0x1400040e570}, 0x14000400360, 0x14000137e20)
    /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.33.2/proto/go/provider.pb.go:2696 +0x13c
google.golang.org/grpc.(*Server).processUnaryRPC(0x1400029d6c0, {0x103477188, 0x14000424340}, 0x14000450000, 0x140003a55f0, 0x103b51e00, 0x0)
    /home/runner/go/pkg/mod/google.golang.org/grpc@v1.46.2/server.go:1283 +0xb64
google.golang.org/grpc.(*Server).handleStream(0x1400029d6c0, {0x103477188, 0x14000424340}, 0x14000450000, 0x0)
    /home/runner/go/pkg/mod/google.golang.org/grpc@v1.46.2/server.go:1620 +0x840
google.golang.org/grpc.(*Server).serveStreams.func1.2()
    /home/runner/go/pkg/mod/google.golang.org/grpc@v1.46.2/server.go:922 +0x88
created by google.golang.org/grpc.(*Server).serveStreams.func1
    /home/runner/go/pkg/mod/google.golang.org/grpc@v1.46.2/server.go:920 +0x298

Versions used

CLI
Version 3.32.1 Go Version go1.18.1 Go Compiler gc

Plugins NAME VERSION aws 5.8.0 aws-iam 0.0.5 eks 0.41.2 kubernetes 3.20.0 python unknown tls 4.6.0

Host
OS darwin Version 12.2 Arch arm64

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