pulumi / pulumi-aws

An Amazon Web Services (AWS) Pulumi resource package, providing multi-language access to AWS
Apache License 2.0
445 stars 154 forks source link

[NodeJS] ECS Service Connect: InvalidParameterException: Per request timeout 0 can't be set for tcp application. #4265

Open thecynicalpaul opened 1 month ago

thecynicalpaul commented 1 month ago

Describe what happened

When deploying an ECS service with a task listening to a TCP-type appProtocol, it is impossible to configure timeout in serviceConnectConfiguration.services[n]. Specifically, I want to be able to set the idleTimeout, which you are supposed to be able to do for TCP services (and you can via an AWS dashboard)

When doing so with pulumi/aws, the error in the title happens.

Sample program

The example is a simple service deploying a KeyDb instance, but it works with any other image.

export const service = new aws.ecs.Service("broker-svc", {
  name: "broker",
  cluster: cluster.arn,
  taskDefinition: task.taskDefinitionArn,
  launchType: "FARGATE",
  desiredCount: 1,
  networkConfiguration: {
    assignPublicIp: false,
    subnets: privateSubnetIdList,
    securityGroups: [sg.id]
  },
  serviceConnectConfiguration: {
    enabled: true,
    namespace: namespace.arn,
    services: [{
      portName: portMappingName,
      discoveryName: "broker",
      timeout: {
        idleTimeoutSeconds: 2147483647,
        // perRequestTimeoutSeconds: // 0 - tried also setting this to 0 or undefined with no luck
      },
      clientAlias: [{
        dnsName: "broker.platform.internal",
        port: 6379
      }]
    }]
  }
});

Log output

View in Browser (Ctrl+O): [redacted]

     Type                     Name                           Status                  Info
     pulumi:pulumi:Stack      platform-dev                   **failed**              1 error; 2 messages
 ~   ├─ pulumi:providers:aws  aws-us-east-1-region-provider  updated (0.19s)         [diff: -skipMetadataApiCheck~version]
     ├─ aws:ec2:Vpc           vpc                                                    [diff: ~provider]
     │  ├─ aws:ec2:Subnet     pub-subnet-1                                           [diff: ~provider]
     │  │  └─ aws:ec2:Eip     priv-subnet-eip-1                                      [diff: ~provider]; 1 warning
     │  └─ aws:ec2:Subnet     pub-subnet-0                                           [diff: ~provider]
     │     └─ aws:ec2:Eip     priv-subnet-eip-0                                      [diff: ~provider]; 1 warning
 ~   └─ aws:ecs:Service       broker-svc                     **updating failed**     [diff: ~serviceConnectConfiguration]; 1 error

Diagnostics:
  aws:ecs:Service (broker-svc):
    error: 1 error occurred:
        * updating urn:pulumi:dev::platform::aws:ecs/service:Service::broker-svc: 1 error occurred:
        * updating ECS Service ([redacted]): InvalidParameterException: Per request timeout 0 can't be set for tcp application.

  pulumi:pulumi:Stack (platform-dev):
    A new release of infisical is available: 0.22.2 -> 0.24.0
    To update, run: brew update && brew upgrade infisical

    error: update failed

This is the detailed changes of the service:

      ~ serviceConnectConfiguration: {
          ~ services: [
              ~ [0]: {
                      ~ timeout: {
                          ~ idleTimeoutSeconds: 0 => 2147483647
                        }
                    }
            ]
        }

Affected Resource(s)

AWS/ECS/Service

Output of pulumi about

Contains private information, can share details on request.

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

corymhall commented 1 month ago

@thecynicalpaul thanks for raising this with us! I've been able to trace the issue to an issue in upstream Terraform and have created an issue https://github.com/hashicorp/terraform-provider-aws/issues/38432