cool-flower-46371
07/05/2022, 5:42 PMbillowy-army-68599
07/05/2022, 6:21 PMapply
You already did that by logging the arn in a previous post, you just now need to build the JSON for the task definitioncool-flower-46371
07/05/2022, 6:37 PMconst taskDef = new aws.ecs.TaskDefinition(`${publicConfig.service_name}-task-definition`, {
family: `${publicConfig.service_name}-family`,
requiresCompatibilities: ["FARGATE"],
memory: "1024",
cpu: "512",
networkMode: "awsvpc",
executionRoleArn: "arn:aws:iam::************:role/ecsTaskExecutionRole",
taskRoleArn: "arn:aws:iam::************:role/ecsInstanceRole",
containerDefinitions: image.imageName.apply((image) => {
return JSON.stringify([
{
name: publicConfig.service_name,
image,
essential: true,
environment: [
{ name: "AWS_REGION", value: "us-east-1" },
],
secrets: [
{ name: "CONNECTION_STRING", valueFrom: connectionString.arn },
],
portMappings: [
{
containerPort: 80,
hostPort: 80,
},
],
},
]);
}),
});
connectionString.arn
without using it in an Apply somewhere.const taskDef = new aws.ecs.TaskDefinition(`${publicConfig.service_name}-task-definition`, {
family: `${publicConfig.service_name}-family`,
requiresCompatibilities: ["FARGATE"],
memory: "1024",
cpu: "512",
networkMode: "awsvpc",
executionRoleArn: "arn:aws:iam::************:role/ecsTaskExecutionRole",
taskRoleArn: "arn:aws:iam::************:role/ecsInstanceRole",
containerDefinitions: pulumi.all([image.imageName, connectionString.arn]).apply([image, connectionString] => {
return JSON.stringify([
{
name: publicConfig.service_name,
image,
essential: true,
environment: [
{ name: "AWS_REGION", value: "us-east-1" },
],
secrets: [
{ name: "CONNECTION_STRING", valueFrom: connectionString },
],
portMappings: [
{
containerPort: 80,
hostPort: 80,
},
],
},
]);
}),
});
billowy-army-68599
07/05/2022, 6:45 PMconnectionString.arn
without resolving it inside the apply. Once you use pulumi.all
it'll workcool-flower-46371
07/05/2022, 6:45 PMbillowy-army-68599
07/05/2022, 7:12 PMapply
is helpful: https://leebriggs.co.uk/blog/2021/05/09/pulumi-applycool-flower-46371
07/05/2022, 7:13 PMvalueFrom
instead of taking advantage of the fact that we were already using one (and just converting it to pulumi.all)billowy-army-68599
07/05/2022, 7:17 PMcool-flower-46371
07/05/2022, 7:18 PM