https://pulumi.com logo
#general
Title
# general
l

limited-dusk-32272

01/20/2023, 3:09 PM
Hi Team, I am new to pulumi and trying to create ECS task definition on AWS. Along with this, I am also creating more resources like cluster, role, security group. In this task definition, I am passing few environment variables. In this env variables, I am passing Id/ARN of other resources. But pulumi is throwing error for fetching data of resources(cluster, secutiry group and role) and assigning this error as a value to these env variables. Below is screenshot of what is deploying on AWS.
Can someone please help me on this issue? I have tried to use apply() method as per pulumi documentation and suggested in error. But still getting same error.
b

billowy-army-68599

01/20/2023, 3:12 PM
@limited-dusk-32272 you need to build the task definition using an
apply
which language are you using?
l

limited-dusk-32272

01/20/2023, 3:18 PM
@billowy-army-68599 I am using typescript. Yes I have also tried apply() method but still same error. Please see attached screenshot:
b

billowy-army-68599

01/20/2023, 3:21 PM
you’re using
apply
wrong. You need to use it at the top level, where the environment is invoked. Here’s an example: https://github.com/jaxxstorm/brig.gs/blob/main/webapp.ts#L245-L270
l

limited-dusk-32272

01/20/2023, 3:24 PM
THanks @billowy-army-68599 Let me try this solution
Many many thanks @billowy-army-68599 your shared solution working for me. One more last thing, can you please give me some idea how can we resolve this error:
This is the code:
b

billowy-army-68599

01/20/2023, 3:56 PM
it is exactly the same issue as the previous error
l

limited-dusk-32272

01/20/2023, 4:03 PM
I think yes but you can see here, error message is saying something related to interpolation and in the previous error, error was related to JSON string. Although I have also tried your shared solution on this code but it is not working. Please check below code where getting same error and applied your solution:
b

billowy-army-68599

01/20/2023, 4:11 PM
You’re trying to use an output type as an interpolated string. That won’t work. Please use an apply
l

limited-dusk-32272

01/20/2023, 4:32 PM
@billowy-army-68599 Are you saying something like this:
b

billowy-army-68599

01/20/2023, 4:35 PM
no. the apply needs to be at the root of the string build
l

limited-dusk-32272

01/20/2023, 4:49 PM
Already doing the same thing.
b

billowy-army-68599

01/20/2023, 5:01 PM
you're going to need to read up on how apply works I think https://www.pulumi.com/docs/intro/concepts/inputs-outputs/
2 Views