Hi all! Not sure if that’s the right place but nee...
# general
w
Hi all! Not sure if that’s the right place but need help with running a one time task (db migration) as part of my ECS deployment. I came across https://npm.io/package/pulumi-run-fargate-task but not sure if that’s still the way + how it’s being executed. Can anyone please help?
Copy code
const dbMigrateTask = new awsx.ecs.FargateTaskDefinition(
  'setup-db',
  {
    container: {
      image: image,
      command: pulumi
        .all([rdsInstance.endpoint])
        .apply(([url]) => ['/bin/sh', '-c', `DATABASE_URL=${url} npx prisma migrate deploy`]),
      environment: [
        {
          name: 'DATABASE_URL',
          value: rdsInstance.endpoint.apply(
            (v) => `postgresql://${rdsSettings.username}:${rdsSettings.password}@${v}/${rdsSettings.database}`,
          ),
        },
      ],
    },
  },
  { dependsOn: [rdsInstance] },
)

dbMigrateTask.run({ cluster: cluster })
Also tried the following, but getting
Copy code
Error: Cannot call '.get' during update or preview.
    To manipulate the value of this Output, use '.apply' instead.
Any ideas?
g
So I don't really recognize that package, so I'll let a community member weigh in if they have used it.
For your code with awsx, though, the error message doesn’t really match the code as I don’t see a
.get
, but I do see a few
.apply
calls. I'm not quite sure what's going on. Can you run a pulumi up with debugging on?
Copy code
TF_LOG=TRACE pulumi up --logtostderr -v=9 2> out.txt