Hi Team, I am new to pulumi and trying to create E...
# general
l
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
@limited-dusk-32272 you need to build the task definition using an
apply
which language are you using?
l
@billowy-army-68599 I am using typescript. Yes I have also tried apply() method but still same error. Please see attached screenshot:
b
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
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
it is exactly the same issue as the previous error
l
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
You’re trying to use an output type as an interpolated string. That won’t work. Please use an apply
l
@billowy-army-68599 Are you saying something like this:
b
no. the apply needs to be at the root of the string build
l
Already doing the same thing.
b
you're going to need to read up on how apply works I think https://www.pulumi.com/docs/intro/concepts/inputs-outputs/