pulumi / pulumi-eks

A Pulumi component for easily creating and managing an Amazon EKS Cluster
https://www.pulumi.com/registry/packages/eks/
Apache License 2.0
171 stars 81 forks source link

java.lang.IllegalArgumentException: '@Import com.pulumi.aws.eks.ClusterArgs.roleArn' is required but was not given a value #1402

Closed t0yv0 closed 1 month ago

t0yv0 commented 1 month ago

What happened?

Getting this problem on pulumi up on the 3.x testing:

java.lang.IllegalArgumentException: '@Import com.pulumi.aws.eks.ClusterArgs.roleArn' is required but was not given a value 

With the latest alpha:

    <dependencies>
        <dependency>
            <groupId>com.pulumi</groupId>
            <artifactId>pulumi</artifactId>
            <version>(,1.0]</version>
        </dependency>
        <dependency>
            <groupId>com.pulumi</groupId>
            <artifactId>aws</artifactId>
            <version>(6.0.2,6.99]</version>
        </dependency>
        <dependency>
            <groupId>com.pulumi</groupId>
            <artifactId>eks</artifactId>
            <version>3.0.0-alpha.7</version>
        </dependency>
    </dependencies>

This is unexpected, ClusterArgs does not even have roleArn. Wondering if something in Java SDK generation is going awry here.

Example


package myproject;

import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.Bucket;
import com.pulumi.aws.eks.Cluster;

public class App {
    public static void main(String[] args) {
        Pulumi.run(ctx -> {
            var c = new Cluster("my-cluster");
            ctx.export("cid", c.id());
        });
    }
}

Output of pulumi about

N/A

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

t0yv0 commented 1 month ago

javagen version is behind, v0.9.8 vs 0.16.1, we need to automate having this up-to-date, likely fixing the issue here.

flostadler commented 1 month ago

rolearn is required for aws.eks.Cluster (that's the CR, not the component). The error is about that. See: https://www.pulumi.com/registry/packages/aws/api-docs/eks/cluster/#rolearn_java

t0yv0 commented 1 month ago

You are right! Trying this:

package myproject;

import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.Bucket;
import com.pulumi.eks.Cluster;

public class App {
    public static void main(String[] args) {
        Pulumi.run(ctx -> {
            new Cluster("my-cluster");
        });
    }
}

This looks better.

Panics though.

Please choose a stack, or create a new one: dev
Previewing update (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/anton-pulumi-corp/java-test/dev/previews/7d89ba14-585a-4384-b0f6-139ef0fdefe7

     Type                                   Name                                          Plan       Info
 +   pulumi:pulumi:Stack                    java-test-dev                                 create     2 errors; 21 messages
 +   └─ eks:index:Cluster                   my-cluster                                    create     
 +      β”œβ”€ eks:index:ServiceRole            my-cluster-instanceRole                       create     
 +      β”‚  β”œβ”€ aws:iam:Role                  my-cluster-instanceRole-role                  create     
 +      β”‚  β”œβ”€ aws:iam:RolePolicyAttachment  my-cluster-instanceRole-3eb088f2              create     
 +      β”‚  β”œβ”€ aws:iam:RolePolicyAttachment  my-cluster-instanceRole-03516f97              create     
 +      β”‚  └─ aws:iam:RolePolicyAttachment  my-cluster-instanceRole-e1b295bd              create     
 +      β”œβ”€ eks:index:ServiceRole            my-cluster-eksRole                            create     
 +      β”‚  β”œβ”€ aws:iam:Role                  my-cluster-eksRole-role                       create     
 +      β”‚  └─ aws:iam:RolePolicyAttachment  my-cluster-eksRole-4b490823                   create     
 +      β”œβ”€ aws:iam:InstanceProfile          my-cluster-instanceProfile                    create     
 +      β”œβ”€ aws:ec2:SecurityGroup            my-cluster-eksClusterSecurityGroup            create     
 +      β”œβ”€ aws:ec2:SecurityGroupRule        my-cluster-eksClusterInternetEgressRule       create     
 +      β”œβ”€ aws:eks:Cluster                  my-cluster-eksCluster                         create     
 +      β”œβ”€ aws:ec2:SecurityGroup            my-cluster-nodeSecurityGroup                  create     
 +      β”œβ”€ aws:eks:Addon                    my-cluster-coredns                            create     
 +      β”œβ”€ aws:eks:Addon                    my-cluster-kube-proxy                         create     
 +      β”œβ”€ aws:ec2:SecurityGroupRule        my-cluster-eksExtApiServerClusterIngressRule  create     
 +      β”œβ”€ aws:ec2:SecurityGroupRule        my-cluster-eksNodeInternetEgressRule          create     
 +      β”œβ”€ pulumi:providers:kubernetes      my-cluster-eks-k8s                            create     
 +      β”œβ”€ aws:ec2:SecurityGroupRule        my-cluster-eksNodeIngressRule                 create     
 +      β”œβ”€ eks:index:VpcCniAddon            my-cluster-vpc-cni                            create     
 +      β”‚  └─ aws:eks:Addon                 my-cluster-vpc-cni                            create     
 +      β”œβ”€ aws:ec2:SecurityGroupRule        my-cluster-eksNodeClusterIngressRule          create     
 +      β”œβ”€ aws:autoscaling:Group            my-cluster                                    create     
 +      β”œβ”€ aws:ec2:SecurityGroupRule        my-cluster-eksClusterIngressRule              create     
 +      β”œβ”€ kubernetes:core/v1:ConfigMap     my-cluster-nodeAccess                         create     
 +      └─ aws:ec2:LaunchTemplate           my-cluster-launchTemplate                     create     

Diagnostics:
  pulumi:pulumi:Stack (java-test-dev):
    error: Running program [PID: 11864](/nix/store/y033py0gyjxdvxxhplhyl29s15asp7xc-zulu19.32.13-ca-jdk-19.0.2/bin/java -classpath /nix/store/fg7sva8pccx1zqy63djh4md5qawfqj5l-apache-maven-3.9.5/maven/boot/plexus-classworlds-2.7.0.jar -Dclassworlds.conf=/nix/store/fg7sva8pccx1zqy63djh4md5qawfqj5l-apache-maven-3.9.5/maven/bin/m2.conf -Dmaven.home=/nix/store/fg7sva8pccx1zqy63djh4md5qawfqj5l-apache-maven-3.9.5/maven -Dlibrary.jansi.path=/nix/store/fg7sva8pccx1zqy63djh4md5qawfqj5l-apache-maven-3.9.5/maven/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/Users/anton/Library/Mobile Documents/com~apple~CloudDocs/pulumi-bugs/test-eks-alpha/java-test org.codehaus.plexus.classworlds.launcher.Launcher -Dorg.slf4j.simpleLogger.defaultLogLevel=warn --no-transfer-progress compile exec:java) failed with an unhandled exception:
    java.lang.UnsupportedOperationException: Convert [com.pulumi.eks.Cluster.defaultNodeGroup]: Error converting 'com.google.common.collect.RegularImmutableMap' to 'TypeShape{type=class com.pulumi.eks.outputs.NodeGroupData, parameters=[]}'. Expected type 'com.pulumi.eks.outputs.NodeGroupData' (annotated with 'com.pulumi.core.annotations.CustomType') to have a setter annotated with @com.pulumi.core.annotations.CustomType$Setter("autoScalingGroup"), got: autoScalingGroupName,nodeSecurityGroup,extraNodeSecurityGroups
        at com.pulumi.serialization.internal.Converter.convertObjectUntyped(Converter.java:119)
        at com.pulumi.serialization.internal.Converter.convertValue(Converter.java:86)
        at com.pulumi.core.internal.OutputCompletionSource.setValue(OutputCompletionSource.java:95)
        at com.pulumi.deployment.internal.DeploymentImpl$ReadOrRegisterResourceInternal.lambda$completeResourceAsync$1(DeploymentImpl.java:1258)
        at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
        at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1311)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1841)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1806)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
    Caused by: java.lang.IllegalArgumentException: Expected type 'com.pulumi.eks.outputs.NodeGroupData' (annotated with 'com.pulumi.core.annotations.CustomType') to have a setter annotated with @com.pulumi.core.annotations.CustomType$Setter("autoScalingGroup"), got: autoScalingGroupName,nodeSecurityGroup,extraNodeSecurityGroups
        at com.pulumi.serialization.internal.Converter.lambda$tryConvertObjectInner$7(Converter.java:401)
        at java.base/java.util.HashMap.forEach(HashMap.java:1429)
        at com.pulumi.serialization.internal.Converter.tryConvertObjectInner(Converter.java:399)
        at com.pulumi.serialization.internal.Converter.convertObjectUntyped(Converter.java:115)
        ... 10 more
    error: an unhandled error occurred: '/Users/anton/bin/mvn /Users/anton/bin/mvn -Dorg.slf4j.simpleLogger.defaultLogLevel=warn --no-transfer-progress compile exec:java' exited with non-zero exit code: 32

    Sep 27, 2024 3:29:35 PM com.pulumi.deployment.internal.DeploymentImpl$DefaultEngineLogger errorAsync
    SEVERE: Running program [PID: 11864](/nix/store/y033py0gyjxdvxxhplhyl29s15asp7xc-zulu19.32.13-ca-jdk-19.0.2/bin/java -classpath /nix/store/fg7sva8pccx1zqy63djh4md5qawfqj5l-apache-maven-3.9.5/maven/boot/plexus-classworlds-2.7.0.jar -Dclassworlds.conf=/nix/store/fg7sva8pccx1zqy63djh4md5qawfqj5l-apache-maven-3.9.5/maven/bin/m2.conf -Dmaven.home=/nix/store/fg7sva8pccx1zqy63djh4md5qawfqj5l-apache-maven-3.9.5/maven -Dlibrary.jansi.path=/nix/store/fg7sva8pccx1zqy63djh4md5qawfqj5l-apache-maven-3.9.5/maven/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/Users/anton/Library/Mobile Documents/com~apple~CloudDocs/pulumi-bugs/test-eks-alpha/java-test org.codehaus.plexus.classworlds.launcher.Launcher -Dorg.slf4j.simpleLogger.defaultLogLevel=warn --no-transfer-progress compile exec:java) failed with an unhandled exception:
    java.lang.UnsupportedOperationException: Convert [com.pulumi.eks.Cluster.defaultNodeGroup]: Error converting 'com.google.common.collect.RegularImmutableMap' to 'TypeShape{type=class com.pulumi.eks.outputs.NodeGroupData, parameters=[]}'. Expected type 'com.pulumi.eks.outputs.NodeGroupData' (annotated with 'com.pulumi.core.annotations.CustomType') to have a setter annotated with @com.pulumi.core.annotations.CustomType$Setter("autoScalingGroup"), got: autoScalingGroupName,nodeSecurityGroup,extraNodeSecurityGroups
        at com.pulumi.serialization.internal.Converter.convertObjectUntyped(Converter.java:119)
        at com.pulumi.serialization.internal.Converter.convertValue(Converter.java:86)
        at com.pulumi.core.internal.OutputCompletionSource.setValue(OutputCompletionSource.java:95)
        at com.pulumi.deployment.internal.DeploymentImpl$ReadOrRegisterResourceInternal.lambda$completeResourceAsync$1(DeploymentImpl.java:1258)
        at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
        at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1311)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1841)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1806)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
    Caused by: java.lang.IllegalArgumentException: Expected type 'com.pulumi.eks.outputs.NodeGroupData' (annotated with 'com.pulumi.core.annotations.CustomType') to have a setter annotated with @com.pulumi.core.annotations.CustomType$Setter("autoScalingGroup"), got: autoScalingGroupName,nodeSecurityGroup,extraNodeSecurityGroups
        at com.pulumi.serialization.internal.Converter.lambda$tryConvertObjectInner$7(Converter.java:401)
        at java.base/java.util.HashMap.forEach(HashMap.java:1429)
        at com.pulumi.serialization.internal.Converter.tryConvertObjectInner(Converter.java:399)
        at com.pulumi.serialization.internal.Converter.convertObjectUntyped(Converter.java:115)
        ... 10 more

    [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!

I'd update Java before we investigate further.

flostadler commented 1 month ago

Fixed it with Fix output of default node group referring to autoscalingGroupName #1410. Release is currently running