FargateService requires the TaskDefinition type and using existing task definition is not allowed.
Becasue cloudformation is missing some features such as TaskDefinition with EFS support, we may create our own task definition with CLI or console and allow CDK to create Fargate service by importing the existing task definition.
Maybe we can simply use ITaskDefinition instead?
The drawback is we will not be able to check the defaultContainer here.
This is a :rocket: Feature Request
related to https://github.com/aws/aws-cdk/issues/6240
I also need this feature, to be able to define the TaskDefinition externally to support EFS volumes for Fargate.
Most helpful comment
I also need this feature, to be able to define the TaskDefinition externally to support EFS volumes for Fargate.