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

most-judge-33290

07/10/2019, 4:27 PM
I am getting an error that subnets cannot be empty with the following
Copy code
new awsx.ecs.FargateService(imageName, {
    name: imageName,
    cluster,
    subnets: ['subnet-1', 'subnet-2, 'subnet-3'],
    securityGroups: ['sg-x'],
    taskDefinitionArgs: {
      container: {
        image: `<http://myaccount.dkr.ecr.us-west-2.amazonaws.com/${imageName}|myaccount.dkr.ecr.us-west-2.amazonaws.com/${imageName}>`,
        cpu: compute || 512 /*10% of 1024*/,
        memory: memory || 512 /*MB*/,
        portMappings: [targetGroupListener],
        environment: environment || [
          { name: 'NODE_ENV', value: 'production' },
          { name: 'PORT', value: '80' },
        ],
      },
    },
    desiredCount: desiredCount || 2,
  });
w

white-balloon-205

07/10/2019, 4:41 PM
What is the exact error message?
m

most-judge-33290

07/10/2019, 4:49 PM
Copy code
Plan apply failed: InvalidParameterException: subnets can not be empty.
    	status code: 400, request id: 0e12e236-0189-418c-a510-6961c10c28be "fieldbook_mobile_api"
w

white-balloon-205

07/10/2019, 4:55 PM
If you run
pulumi preview --diff
does it show you what values are being passed to
networkConfiguration
on the
Service
? (in particular the
subnets
)?
m

most-judge-33290

07/10/2019, 4:57 PM
Copy code
networkConfiguration           : {
                assignPublicIp: true
                securityGroups: [
                    [0]: "sg-x"
                ]
            }
w

white-balloon-205

07/10/2019, 4:57 PM
Ahh - looks like there may actually be a bug here - the
subnets
argument will not be passed along. You should though be getting the subnets associated with
cluster.vpc.publicSubnetIds
- not clear why that would be empty? (though it's not what you want here regardless). cc @lemon-spoon-91807 https://github.com/pulumi/pulumi-awsx/blob/e709a077df4233eef0615bad09d0f6828e50f2bd/nodejs/awsx/ecs/fargateService.ts#L210
@most-judge-33290 would you mind opening an issue on this?
l

lemon-spoon-91807

07/10/2019, 4:58 PM
yup. this is a straight up bug
i'll open the issue
no need for @most-judge-33290 to have to do it 🙂
i'll fix today, thanks for the report!
m

most-judge-33290

07/10/2019, 4:59 PM
ok, thanks guys
l

lemon-spoon-91807

07/10/2019, 4:59 PM
Looks like @gentle-diamond-70147 already did! https://github.com/pulumi/pulumi-awsx/issues/360