Just starting out with typescript and nodejs, but I've got to tackle some issues in the typescript code.
I'm looking to execute an ECS one-off task using Pulumi. I have the documentation on how to run the task from the taskDefinition, which can be found here.
However, without a detailed explanation, I'm struggling to understand how to invoke the `run` action mentioned here:
public run: (params: RunTaskRequest) => Promise<awssdk.ECS.Types.RunTaskResponse>;
There's an example provided for running this with api-gateway, but it doesn't clarify how to call the `run` function as a stand-alone action. You can check it out here.
Any advice or assistance would be greatly appreciated!
UPD: Here is the more detailed block of code that I'm working with:
const kafkaTask = new awsx.ecs.FargateTaskDefinition("kafka1-task-efs", {
vpc: vpcSelected,
containers: {
kafkaTask: {
image: imageKafkaTaskEfs,
logConfiguration: {
logDriver: "awslogs",
options: {
"awslogs-group": "ecs-kafka1",
"awslogs-region": "eu-central-1",
"awslogs-stream-prefix": "kafka1-task-efs"
}
},
mountPoints: [
{containerPath: "/mnt/kafka/data", sourceVolume: "kafka-data"},
{containerPath: "/mnt/kafka/secrets", sourceVolume: "kafka-secrets"},
{containerPath: "/mnt/zookeeper/log", sourceVolume: "zookeeper-log"},
{containerPath: "/mnt/zookeeper/data", sourceVolume: "zookeeper-data"}
]
}
},
volumes: [
{name: "kafka-data", efsVolumeConfiguration: {rootDirectory: "/kafka-data", fileSystemId: fsKafka.id}},
{
name: "kafka-secrets",
efsVolumeConfiguration: {rootDirectory: "/kafka-secrets", fileSystemId: fsKafka.id}
},
{
name: "zookeeper-log",
efsVolumeConfiguration: {rootDirectory: "/zookeeper-log", fileSystemId: fsKafka.id}
},
{
name: "zookeeper-data",
efsVolumeConfiguration: {rootDirectory: "/zookeeper-data", fileSystemId: fsKafka.id}
}
]
});
kafkaTask.run({ cluster }).then(res => console.log(res));
UPD2: I encountered the following error, not sure if it provides any helpful insights:
error: Running program '/pulumi/main-infrastructure' failed with an unhandled exception:
Error: Cannot call '.get' during update or preview.
To manipulate the value of this Output, use '.apply' instead.
at Proxy.get (/pulumi/node_modules/@pulumi/pulumi/output.js:172:15)
at FargateTaskDefinition.run (/pulumi/node_modules/@pulumi/ecs/taskDefinition.ts:226:39)
at /pulumi/main-infrastructure/index.ts:127:15
at Generator.next (<anonymous>)
at fulfilled (/pulumi/main-infrastructure/index.ts:5:58)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
error: update failed