https://pulumi.com logo
#getting-started
Title
# getting-started
a

astonishing-beach-97981

11/15/2023, 4:01 AM
Hi guys, I am using Java with AWS, trying to configure a target group for my load balancer:
Copy code
public static TargetGroup targetGroupCreator(Vpc myvpc) {
    return new TargetGroup("myTg", TargetGroupArgs.builder()
            .port(8080)
            .protocol("HTTP")
            .vpcId(myvpc.id())
            .build());
}
and I end up with this error: java.lang.UnsupportedOperationException: Convert [com.pulumi.aws.alb.TargetGroup.targetHealthStates]: Error converting 'java.util.Collections$UnmodifiableRandomAccessList' to 'TypeShape{type=interface java.util.List, parameters=[TypeShape{type=class com.pulumi.aws.alb.outputs.TargetGroupTargetHealthState, parameters=[]}]}'. null Went over all resources in docs and example repo on github, cannot figure it out. Docs indicate that targetHealthStates does not apply to HTTP and therefore I left it out. Apparently it is causing problem even with its absence. This code I am testing is pretty much the same as in the example in docs. Has anyone encountered this before? Am I missing something? Thanks for any help or ideas!
e

echoing-dinner-19531

11/15/2023, 8:20 AM
This looks like a Java SDK bug rather than anything AWS specific. Firstly do raise an issue about this on the java repo, this should just work. As a workaround try setting targetHealthStates to an empty list (not null) in the builder and see if that helps.
a

astonishing-beach-97981

11/15/2023, 8:00 PM
Hi Fraser, Thank you for the reply! I will raise the issue.
w

wonderful-wire-57788

11/21/2023, 10:04 PM
Which version of java should I use? I am getting the same error
w

wooden-country-28133

11/22/2023, 2:57 AM
Try changing the dependency versions in your pom.xml, at least these worked for me <dependency> <groupId>com.pulumi</groupId> <artifactId>pulumi</artifactId> <version>0.9.5</version> </dependency> <dependency> <groupId>com.pulumi</groupId> <artifactId>aws</artifactId> <version>5.42.0</version> </dependency>
4 Views