You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Service class does not expose the taskRole that it automatically creates.
This means that in order to grant access to resources, you need to explicitly create a task role. Whereas using the normal ECS constructs, it's trivial to grant access via the FargateTaskDefinition#taskRole.
I'm guessing the reason for this is that the intention is users grant their services access to resources using the InjecterExtension and creating their own implementations of IGrantInjectable. I'm also guessing the intention is to expand the set of services supported by InjecterExtension. If that is the case, it would be good to talk about that in the documentation.
The text was updated successfully, but these errors were encountered:
One approach to exfiltrating the task role is to create a custom extension which sets the task role as a property:
classMyExtensionextendsServiceExtension{publictaskRole!: iam.IRole;// This assertion requires a guarantee that you won't reference this prop before serviceBuildconstructor(){super('my-task-role-extractor-extension');}publicuseTaskDefinition(taskDefinition: ecs.TaskDefinition){this.taskRole=taskDefinition.taskRole;}}
Then in your implementation you can use the class:
Alternatively, you can just inject the policy directly via the extension constructor props and useTaskDefinition call and avoid having to assign extra variables.
Thanks for the callout, we'll add something to the documentation about this.
The Service class does not expose the taskRole that it automatically creates.
This means that in order to grant access to resources, you need to explicitly create a task role. Whereas using the normal ECS constructs, it's trivial to grant access via the FargateTaskDefinition#taskRole.
I'm guessing the reason for this is that the intention is users grant their services access to resources using the
InjecterExtension
and creating their own implementations ofIGrantInjectable
. I'm also guessing the intention is to expand the set of services supported byInjecterExtension
. If that is the case, it would be good to talk about that in the documentation.The text was updated successfully, but these errors were encountered: