terraform-aws-modules / terraform-aws-ecs

Terraform module to create AWS ECS resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/ecs/aws
Apache License 2.0
575 stars 542 forks source link

feat: Use a list instead of a map when defining services in service connect configuration #195

Closed mattaltberg closed 6 months ago

mattaltberg commented 6 months ago

Description

I modified the service connect configuration block in the service module to allow for multiple services configs in a parent service. This change aligns with how Service Connect is defined in the API.

Motivation and Context

This change is required to allow users to define multiple endpoints for multiple ports/containers in their task definitions. Currently, the module only supports one service connect config per service.

Breaking Changes

Yes

The change is necessary to align with the AWS API for defining services in the service connect config.

How Has This Been Tested?

I've updated my locally downloaded version of the module with the same changes, and updated my HCL to look like so:


locals {
  container_definitions = {
    "a" = {
      port = 8080
    }

    "b" = {
       port = 9090
    }
  }

}

  service_connect_configuration = {
    namespace = aws_service_discovery_http_namespace.namespace.arn

    service = [
      for k, v in local.container_definitions :
      {
        discovery_name = "container_${k}"
        port_name = "container_${k}"
        client_alias = [
          {
            dns_name = "container_${k}"
            port = v.port
          }
        ]
      }
    ]
  }

and the plan is correct.

bryantbiggs commented 6 months ago

already fixed in https://github.com/terraform-aws-modules/terraform-aws-ecs/pull/123 which will be included in v6.0 when released

github-actions[bot] commented 5 months ago

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.