import * as aws from "@pulumi/aws" ; import * as awsx from "@pulumi/awsx" ; import * as pulumi from "@pulumi/pulumi" ; const prefix = "infratest" ; const numberOfAvailabilityZones = 2 ; const instanceType = "m5.large" ; const config = new pulumi . Config ( "aws" ) ; const providerOpts = { provider : new aws . Provider ( "prov" , { region : < aws . Region > config . require ( "envRegion" ) } ) } ; const vpc = new awsx . ec2 . Vpc ( `${ prefix }-net` , { numberOfAvailabilityZones } , providerOpts ) ; const cluster = new awsx . ecs . Cluster ( prefix , { vpc } , providerOpts ) ; cluster . createAutoScalingGroup ( prefix , { subnetIds : vpc . publicSubnetIds , templateParameters : { minSize : 10 , } , launchConfigurationArgs : { instanceType , associatePublicIpAddress : true , } , } ) ; export let vpcId = vpc . vpc . id ; export let privateSubnetIds = pulumi . output ( vpc . privateSubnetIds ) . apply ( ids => ids . join ( "," ) ) ; export let publicSubnetIds = pulumi . output ( vpc . publicSubnetIds ) . apply ( ids => ids . join ( "," ) ) ; export let securityGroupIds = pulumi . output ( cluster . securityGroups . map ( g => g . id ) ) . apply ( ids => ids . join ( "," ) ) ; export let ecsClusterARN = cluster . cluster . arn ;