It seems that the ECS Service connect configuration only creates HTTP/API cloudmap services, even though the terraform code lists the dns_alias. e.g.
- Installing hashicorp/aws v4.49.0
resource "aws_service_discovery_private_dns_namespace" "this" {
name = "this"
vpc = aws_vpn.this.id
}
resource "aws_ecs_service" "service" {
name = "service"
cluster = module.ecs.cluster_id
desired_count = 1
launch_type = "FARGATE"
service_connect_configuration {
enabled = "true"
namespace = aws_service_discovery_private_dns_namespace.this.arn
service {
discovery_name = "service"
port_name = "http"
client_alias = "service"
client_alias {
dns_name = "service"
port = "8080"
}
}
}
Creates this service with NO DNS config and TYPE: HTTP rather than DNS_HTTP
Services:
- Arn: arn:aws:servicediscovery:us-east-1:111111111:service/srv-222222222
CreateDate: '2023-01-20T14:12:48.323000-06:00'
Description: Managed by arn:aws:ecs:us-east-1:1111111:service/cluster/service
DnsConfig: {}
Id: srv-11111111
Name: service
Type: HTTP
In a manually created cloudmap service, it looks like this:
- Arn: arn:aws:servicediscovery:us-east-1:111111111:service/srv-22222222
CreateDate: '2023-01-20T14:58:23.713000-06:00'
DnsConfig:
DnsRecords:
- TTL: 300
Type: A
RoutingPolicy: WEIGHTED
Id: srv-3333
Name: manual
Type: DNS_HTTP