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

go: EKSRole requires that the cluster exists before it can be used in a graph #11

Open stepan-romankov-fi opened 1 year ago

stepan-romankov-fi commented 1 year ago

What happened?

using the output of eks.NewCluster as an input to iam.NewEKSRole doesn't work

cluster, err := eks.NewCluster(ctx, fmt.Sprintf("dev"), nil)

eksRole, err := iam.NewEKSRole(ctx, "sandbox-service", &iam.EKSRoleArgs{
        Role: iam.RoleArgs{
            Name:       pulumi.String("sandbox-service"),
            PolicyArns: pulumi.StringArray{policy.Arn},
        },
        ClusterServiceAccounts: iam.EKSServiceAccountArray{
            iam.EKSServiceAccountArgs{
                Name:            cluster.EksCluster.Name(),
                ServiceAccounts: pulumi.StringArray{pulumi.String("default:sandbox")},
            },
        },
    }, pulumi.Provider(eksProvider))

Expected Behavior

Steps to reproduce

see the two examples in "what happened"

Output of pulumi about

CLI Version 3.63.0 Go Version go1.20.2 Go Compiler gc

Plugins NAME VERSION go unknown

Host OS darwin Version 13.3.1 Arch arm64

This project is written in go: executable='/opt/homebrew/bin/go' version='go version go1.20.3 darwin/arm64'

Additional context

pulumi preview output:

    error: an unhandled error occurred: waiting for RPCs: rpc error: code = Unknown desc = waiting for RPCs: marshaling properties: awaiting input property role: marshaling properties: awaiting input property assumeRolePolicy: rpc error: code = Unknown desc = invocation of aws:eks/getCluster:getCluster returned an error: invoking aws:eks/getCluster:getCluster: 1 error occurred:
        * reading EKS Cluster (dev-cluster): couldn't find resource

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