Am I missing something in the definition of my `aw...
# aws
l
Am I missing something in the definition of my
aws.iam.Role
here? The
Version
property is not assignable…
s
Version is not a property. It is a part of the JSON blob that gets passed to
assumeRolePolicy
.
l
@salmon-ghost-86211
assumeRolePolicy
is defined as follows:
readonly assumeRolePolicy: pulumi.Input<string | PolicyDocument>;
You can either pass a full JSON string blob, or use the
PolicyDocument
type which offers you Intellisense completion in the editor. I chose that and then
Version
is a property defined as:
Version: Input<"2008-10-17" | "2012-10-17">;
s
Yes. You are correct. In that case
Version
and `Statement`are properties under
assumeRolePolicy
. The below worked for me.
Copy code
const testRole = new aws.iam.Role("testRole", {
    assumeRolePolicy: {
        Version: "2012-10-17",
        Statement: [
            {
                "Action": "sts:AssumeRole",
                "Principal": {
                "Service": "<http://ec2.amazonaws.com|ec2.amazonaws.com>"
                },
                "Effect": "Allow",
                "Sid": ""            }
        ]
    },
    tags: {
        "Purpose": "Just testing",
    }
l
Strange. The error was actually in my
Condition
. Once I had that fixed, the error on
Version
disappeared also.
s
I think I actually prefer that layout over the JSON blob.
Interesting.
l
@salmon-ghost-86211 in the snippet you posted, you can even replace the String keys within your
Statement
with property names. In short: remove the quotes in the key names.
s
Yes. I copied an example and modified it quickly, but definitely a good reminder. Thanks.
w
I saw this myself recently. I think there must be a TypeScript compiler bug (and somewhat recent regression) here. For now, you can insert a cast like
as any
.