Hi everyone, I am struggling with something I feel...
# typescript
b
Hi everyone, I am struggling with something I feel is very basic, I have the following FargateService definition, I am trying to configure the Role for
taskRole
, but it keeps rejecting it:
Copy code
const fargateTaskRole = new aws.iam.Role(`${appName}-fargate-task`, {
    assumeRolePolicy: JSON.stringify({
        Version: "2012-10-17",
        Statement: [
            ...
        ],
    }),
});

const appService = new awsx.ecs.FargateService(`${appName}-app-svc`, {
    cluster: cluster.arn,
    desiredCount: 0,
    taskDefinitionArgs: {
        taskRole: fargateTaskRole,
        container: {
            name: `${appName}-sync-container`,
            image: img.imageUri,
            cpu: 102,
            memory: 50,
        },
    },
    ...
});
It won't allow me to assign fargateTaskRole to taskRole. The error is:
Type 'Role' has no properties in common with type 'DefaultRoleWithPolicyArgs'.
Thanks!
s
Curious if you are using an IDE. It's easy to inspect the
DefaultRoleWithPolicyArgs
type if you are... it's
Copy code
interface DefaultRoleWithPolicyArgs {
        /**
         * Args to use when creating the role and policies. Can't be specified if `roleArn` is used.
         */
        args?: inputs.awsx.RoleWithPolicyArgs;
        /**
         * ARN of existing role to use instead of creating a new role. Cannot be used in combination with `args` or `opts`.
         */
        roleArn?: pulumi.Input<string>;
        /**
         * Skips creation of the role if set to `true`.
         */
        skip?: boolean;
    }
so basically instead of
Copy code
taskDefinitionArgs: {
        taskRole: fargateTaskRole,
you need
Copy code
taskDefinitionArgs: {
        taskRole: { roleArn: fargateTaskRole.arn },
b
You're right Mike, thanks! I didn't think about inspecting it. Much appreciated!