chilly-baker-88501
02/10/2025, 1:40 PMconst ecsTaskDefinition = new aws.ecs.TaskDefinition(`${cfg.name}-msk-streams-task`, {
family: `${cfg.name}-msk-streams-task`,
cpu: "2048",
memory: "4096",
networkMode: "awsvpc",
requiresCompatibilities: ["FARGATE"],
executionRoleArn: ecsTaskExecutionRole.arn, // These are fine
taskRoleArn: taskRole.arn, // These are fine
// This doesn't recognize that pulumi needs to pass in the mskCluster.bootstrapBrokersSaslIam because it's buried in the JSON.stringify
// instead of being a direct input to the new.
// This works but is not ideal. Two nested applies makes it unappealing to say the least
containerDefinitions: mskCluster.bootstrapBrokersSaslIam.apply(bootstrapServers => {
return mskStreamsImage.ref.apply(mskStreamsImageRef => {
return JSON.stringify([{
name: ecsContainerName,
image: mskStreamsImageRef,
essential: true,
portMappings: [
{ containerPort: 8080, hostPort: 8080, protocol: "tcp" },
{ containerPort: 9098, hostPort: 9098, protocol: "tcp" },
{ containerPort: 9092, hostPort: 9092, protocol: "tcp" },
],
environment: [
{ name: "KAFKA_BOOTSTRAP_SERVERS", value: bootstrapServers },
],
logConfiguration: {
logDriver: "awslogs",
options: {
"awslogs-group": logGroupName,
"awslogs-region": "eu-west-1",
"awslogs-stream-prefix": "ecs",
},
},
}])
})
}
),
}, { dependsOn: [mskCluster] });
quick-house-41860
02/10/2025, 1:43 PMpulumi.jsonStringify({})
, this is essentially a version of JSON.stringify
that can handle outputschilly-baker-88501
02/10/2025, 1:43 PMquick-house-41860
02/10/2025, 1:45 PMchilly-baker-88501
02/10/2025, 1:46 PMlate-balloon-24601
02/10/2025, 6:24 PMpulumi.all()
, eg
containerDefinitions: pulumi.all([mskCluster.bootstrapBrokersSaslIam, mskStreamsImage.ref]).apply(([bootstrapBrokersSaslIam, mskStreamsImageRef]) => {
return ...
})
chilly-baker-88501
02/14/2025, 11:43 AM