Anyone knows if there somewhere is type definition...
# aws
f
Anyone knows if there somewhere is type definitions for ECS TaskDefs? Docs just use
JSON.toString({...})
:S (for TypeScript)
b
We don’t have a type definition in the AWS provider (although the names are the same as in the official AWS docs: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html) If types were really important, you could create your task definitions using the AWS Native provider which do have strongly typed container definitions. Providers can be used together as generally the outputs are ARNs or IDs
f
thanks for info 🙂
I guess for the raw typing (to get completion, etc) I could just use the type: https://www.pulumi.com/registry/packages/awsx/api-docs/ecs/ec2taskdefinition/#taskdefinitioncontainerdefinition
b
You probably could but we can’t ensure that this type is going to stay consistent with what’s in the AWS provider. The AWS native one is probably more reliable
f
well in the non-native it's just a string, so was thinking something like:
Copy code
const conatinerDefs: TaskDefinitionContainerDefinition[] = [...];
new aws.ecs.TaskDefinition("myTaskDef, {
  containerDefinitions: JSON.stringify(containerDefs)
  ...
b
That should work yes
f
This works well so far. FWIW: the decalration for me looks like this:
Copy code
const containerDefinitions: aws_native.types.input.ecs.TaskDefinitionContainerDefinitionArgs[] = [...]