https://pulumi.com logo
#aws
Title
# aws
i

incalculable-portugal-13011

02/20/2020, 6:56 PM
hey all, having trouble getting an ecs service definition to work using pulumi/awsx in js. my service definition looks like:
Copy code
let appVpc = aws.ec2.getVpc({id: "my-vpc-id"});

const webServerLoadBalancer = new awsx.lb.ApplicationLoadBalancer("web-server-lb-" + userEnv, {
    securityGroups: [],
    vpc: appVpc,
    subnets: ["subnet-1", "subnet-2", "subnet-3"]
});

const webServerLoadBalancerListener = webServerLoadBalancer.createListener("ws-https-" + userEnv, {
    port: 443,
    protocol: "HTTPS",
    certificateArn: "my-cert-arn"
});

const webServerLoadBalancerRedirectToHttpsListener = webServerLoadBalancer.createListener("ws-redirect-to-https", {
    port: 80,
    protocol: "HTTP",
    defaultAction: {
        type: "redirect",
        redirect: {
            protocol: "HTTPS",
            port: "443",
            statusCode: "HTTP_301"
        }
    }
});

const webServerCluster = new awsx.ecs.Cluster("web-server-" + userEnv, {
    securityGroups: ["sg-1"],
    vpc: appVpc
});

const webServerFargateService = new awsx.ecs.FargateService("web-server-" + userEnv, {
    cluster: webServerCluster,
    networkConfiguration: {
        subnets: ["subnet-1", "subnet-2", "subnet-3"]
    },
    taskDefinitionArgs: {
        containers: {
            webServer: {
                image: "my-org/web-server:" + userEnv,
                portMappings: [
                    webServerLoadBalancerListener
                ],
                healthCheck: {...healthCheckArgs}
            }
        }
    }
});
the error I’m receiving is that
error: aws:ecs/service:Service resource 'web-server-dev' has a problem: "network_configuration.0.subnets": required field is not set
, which doesn’t make sense to me. per the docs, I’m setting the
networkConfiguration
property of the service, and I’m tried both wrapping that property in an array and as an object. no dice either way. any thoughts? (edited)
5 Views