0

I'm trying to create an ECS Service using Pulumi with task with network mode bridge in order to run multiple tasks on an instance.

When creating the service, pulumi outputs error: Plan apply failed: InvalidParameterException: Network Configuration is not valid for the given networkMode of this task definition. which is not valid.

It seems pulumi provides a networkConfiguration even though this is not permitted when the network mode is bridge:

    [urn=urn:pulumi:dev::pulumi::pulumi:pulumi:Stack::pulumi-dev]
        + aws:ecs/service:Service: (create)
            [urn=urn:pulumi:dev::pulumi::awsx:x:ecs:EC2Service$aws:ecs/service:Service::test]
            cluster                        : "arn:aws:ecs:eu-central-1:131009595785:cluster/test-12196f9"
            deploymentMaximumPercent       : 200
            deploymentMinimumHealthyPercent: 100
            desiredCount                   : 2
            enableEcsManagedTags           : false
            launchType                     : "EC2"
            loadBalancers                  : [
                [0]: {
                    containerName : "backend"
                    containerPort : 3000
                    targetGroupArn: "arn:aws:elasticloadbalancing:eu-central-1:131009595785:targetgroup/57d096ee-73ab93e/fce1408d3c067066"
                }
            ]
            name                           : "test-3e870ec"
            networkConfiguration           : {
                assignPublicIp: false
                securityGroups: [
                    [0]: "sg-035513ef294414b65"
                ]
                subnets       : [
                    [0]: "subnet-08831ff5642406fc7"
                    [1]: "subnet-00e3e870707b6aa90"
                ]
            }
            schedulingStrategy             : "REPLICA"
            taskDefinition                 : "arn:aws:ecs:eu-central-1:131009595785:task-definition/test-aece9bcd:24"
            waitForSteadyState             : true

Is there a way to avoid setting the networkConfiguration? I can set securityGroups and subnets of the service to [] but there is no way to set assignPublicIp.

Markus
  • 79
  • 1
  • 9

1 Answers1

0

Looks like this was not yet supported by pulumi but was fixed in PR 233 with this change.

The fix is included in pulumi-awsx 0.18.2.

A networkConfiguration is now only specified for network mode awsvpc.

Markus
  • 79
  • 1
  • 9