-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RunEcsEc2Task task_definition accepts TaskDefinition instead of ITaskDefinition #2948
Comments
Let's take a look and determine the scope of this fix. |
So, there are 3 places where we are currently using properties in The problem is the later 2 are required properties, which cannot be sensibly filled for an imported by ARN task definition; and the first one, even though it's optional, needs to be provided, or otherwise an exception will be thrown. This makes it quite tricky to make a Another option could be to re-name them in Thoughts on this? |
@mb-dev unfortunately, we concluded that there's no way to use an imported task definition in |
…d in RunEcsEc2Task. Fixes aws#2948
Is there any alternative, besides from falling back to a Lambda function? |
How to tackle this problem? or any other method |
We can use CustomState. I can solve this problem like below. import * as sfn from "aws-cdk-lib/aws-stepfunctions";
// define parameter type
type RunTaskStateParam = {
Type: "Task";
Resource: "arn:aws:states:::ecs:runTask.sync";
Parameters: {
LaunchType: "FARGATE";
Cluster: string;
TaskDefinition: string;
NetworkConfiguration: {
AwsvpcConfiguration: {
Subnets: string[];
SecurityGroups: string[];
};
};
};
};
// Use CustomState
const step1Param: RunTaskStateParam = {
Type: "Task",
Resource: "arn:aws:states:::ecs:runTask.sync",
Parameters: {
LaunchType: "FARGATE",
Cluster: "${ClusterArn}",
TaskDefinition: "${TaskdefID}",
NetworkConfiguration: {
AwsvpcConfiguration: {
Subnets: ["${SubnetID}"],
SecurityGroups: ["${SecurityGroupID}"],
},
},
},
};
const step1State = new sfn.CustomState(this, "RunExsitingTaskdef", {
stateJson: step1Param,
}); ref: #24097 |
@bun913 Have you met this error |
Describe the bug
RunEcsEc2Task
task_definition
acceptsTaskDefinition
instead ofITaskDefinition
. As a result when assigning task_definition fromecs.TaskDefinition.from_task_definition_arn
I get an error:To Reproduce
Expected behavior
Task definition will be created
Version:
The text was updated successfully, but these errors were encountered: