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

most-judge-33290

06/13/2019, 9:56 PM
fargateService.ts2109
w

white-balloon-205

06/13/2019, 9:57 PM
That sounds like a bug. Could you open an issue at pulumi-awsx GitHub repo and we’ll take a look?
Oh - I think I see the issue - though we should give a better error (or just directly support this). You are passing the result of
aws.ecs.getCluster
which returns a value that is not actually a Cluster. I assume you are not using TypeScript? Pretty sure this would have been an early error in TypeScript. @lemon-spoon-91807 what’s the easiest way to use an existing ECS cluster here?
l

lemon-spoon-91807

06/13/2019, 10:01 PM
one sec
you can say:
new awsx.ecs.Cluster("somename", { cluster })
. This will allow you to built an awsx Cluster from an aws Cluster.
m

most-judge-33290

06/13/2019, 10:12 PM
Thanks
You are right though I was not using typescript
Copy code
Type 'Promise<GetClusterResult>' is missing the following properties from type 'Cluster': arn, name, tags, id, and 2 more.ts(2740)
cluster.d.ts(52, 5): The expected type comes from property 'cluster' which is declared here on type 'ClusterArgs'
when I try that
l

lemon-spoon-91807

06/13/2019, 11:10 PM
Sorry, not at computer. You'll need to look into aws.ecs.Cluster.get as weol
As well
That will let you create the low level cluster from the result you got back.
I can also add a helper here for a future release to help out here
So you could just do awsx.ecs.Cluster.fromExistingIds
m

most-judge-33290

06/13/2019, 11:18 PM
nice, the get worked but clusters dont have ids so you use the name twice
Copy code
var tCluster = aws.ecs.Cluster.get(name ,name);
Copy code
var cluster = new awsx.ecs.Cluster(name, { cluster: tCluster });
I will look forward to future release as that failed
l

lemon-spoon-91807

06/14/2019, 1:21 AM
in terms of your current code, can you try:
Copy code
const result = await aws.ecs.getCluster({ clusterName: clusterName });
    const underlyingCluster = aws.ecs.Cluster.get("whatever", result.id);
    const cluster = new awsx.ecs.Cluster("blahblah", {
        cluster: underlyingCluster,
        securityGroups: [/*fill this in*/],
    });
m

most-judge-33290

06/14/2019, 3:39 PM
thanks guys, i really look forward to expanding with pulumi
l

lemon-spoon-91807

06/14/2019, 3:39 PM
Sure!
And please keep the feedback coming 🙂