hey guys qq trying to deploy ECS fargate and pass ...
# python
hey guys qq trying to deploy ECS fargate and pass it a secret in container definitions
Copy code
```task_definition = aws.ecs.TaskDefinition('pulumi-app-task',
   tags = global_tags,
      'secrets' : json.dumps([{'db_password': f"{db_password.id}"}]),
      'name': 'pulumi-test-app',
      'image': 'nginx',
      'portMappings': [{
         'containerPort': 80,
         'hostPort': 80,
         'protocol': 'tcp'
having issues with this line  'secrets' : json.dumps([{'db_password': f"{db_password.id}"}]),
I assume this is because its returning an aws ARN im getting an unmarshelled string error converting to json. is this the case?
rror: aws:ecs/taskDefinition:TaskDefinition resource 'pulumi-app-task' has a problem: ECS Task Definition container_definitions is invalid: Error decoding JSON: json: cannot unmarshal string into Go struct field ContainerDefinition.Secrets of type []*ecs.Secret. Examine values at 'TaskDefinition.ContainerDefinitions'.
im new to pulumi and havent quite figured out how to use a debugger with it yet so havning to guess alot at what values which come back look like. (I know the second json dumps isnt needed but there for debugging)
@ambitious-article-39970 you can't pass an output (ie the result of provisioning another resource) into a container definition because container definitions only take strings I would first read this: https://www.leebriggs.co.uk/blog/2021/05/09/pulumi-apply.html Then update your code to look like this: https://github.com/pulumi/examples/blob/258d3bad0a00020704743e37911c51be63c06bb4/aws-py-voting-app/__main__.py#L162
thanks I still seem to have issues when using apply to pull the string out of the output though
another soul bitten by Outputs. I'm doing fargate as well - you can find a lot of my discussions above. The solution to construct more complex JSON objects is use
for each level of the structure that contains outputs + you cannot use
the inner JSON will produce escaped json string which is what you do not want
I will try to produce a good example in few days, when I'm back
@ambitious-article-39970 look at my post above I found a very simple solution