I am getting an error that subnets cannot be empty...
# general
m
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
What is the exact error message?
m
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
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
Copy code
networkConfiguration           : {
                assignPublicIp: true
                securityGroups: [
                    [0]: "sg-x"
                ]
            }
w
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
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
ok, thanks guys
l
Looks like @gentle-diamond-70147 already did! https://github.com/pulumi/pulumi-awsx/issues/360