I'm not sure if this is the correct place to comme...
# java
r
I'm not sure if this is the correct place to comment, but I'm having a problem with AWS and Kotlin. I've reported a bug here: https://github.com/pulumi/pulumi-java/issues/1183 Is anyone else using this combo and have a difference experience?
r
Hi Don, I use Kotlin too and define the policy using IamFunctions ... Just a sample here:
Copy code
private val assumeRole = IamFunctions.getPolicyDocument(
    GetPolicyDocumentArgs.builder()
        .statements(
            GetPolicyDocumentStatementArgs.builder()
                .effect("Allow")
                .actions("sts:AssumeRole")
                .principals(
                    GetPolicyDocumentStatementPrincipalArgs.builder()
                        .type("Service")
                        .identifiers("<http://glue.amazonaws.com|glue.amazonaws.com>")
                        .build()
                ).build()
        ).build()
)
and
Copy code
private val policy = IamFunctions.getPolicyDocument(
    GetPolicyDocumentArgs.builder()
        .statements(
            GetPolicyDocumentStatementArgs.builder()
                .effect("Allow")
                .actions("s3:GetObject*", "s3:ListObject*")
                .resources(makeBucketArns(dataCatalogInput.sourceBucket.arn()))
                .build()
        ).build()
)
... 
fun makeBucketArns(arn: Output<String>): Output<List<String>>? {
    return arn.applyValue { v: String ->
        listOf(v, "$v/*")
    }
}
r
Thanks Kim, I only just saw this and it's very helpful!