diff --git a/pkg/templates/aws/edges/target_group-ecs_service.yaml b/pkg/templates/aws/edges/target_group-ecs_service.yaml index dff4f0eb6..f29f408b2 100644 --- a/pkg/templates/aws/edges/target_group-ecs_service.yaml +++ b/pkg/templates/aws/edges/target_group-ecs_service.yaml @@ -8,7 +8,7 @@ operational_rules: field: LoadBalancers value: - TargetGroup: '{{ .Source }}' - ContainerName: '{{ .Target.Name }}' + ContainerName: '{{ (downstream "aws:ecs_task_definition" .Target).Name }}' ContainerPort: '{{ fieldValue "PortMappings[0].ContainerPort" (fieldValue "TaskDefinition" .Target)}}' - resource: '{{ .Source }}' configuration: diff --git a/pkg/templates/aws/resources/load_balancer.yaml b/pkg/templates/aws/resources/load_balancer.yaml index a23e1dcaf..88d48c669 100644 --- a/pkg/templates/aws/resources/load_balancer.yaml +++ b/pkg/templates/aws/resources/load_balancer.yaml @@ -3,7 +3,7 @@ display_name: Load Balancer sanitize_name: # https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateLoadBalancer.html # This name must be unique per region per account, - # can have a maximum of 32 characters, + # can have a maximum of 32 characters (24 since we reserve 8 for an IaC-appended suffix), # must contain only alphanumeric characters or hyphens, # must not begin or end with a hyphen, # and must not begin with "internal-". @@ -12,7 +12,7 @@ sanitize_name: | replace `^internal-` "" | replace `(^-)|(-$)` "" | replace `[^[:alnum:]-]+` "-" - | length 1 32 + | length 1 24 }} properties: diff --git a/pkg/templates/aws/resources/target_group.yaml b/pkg/templates/aws/resources/target_group.yaml index 1196613a8..4fe193e19 100644 --- a/pkg/templates/aws/resources/target_group.yaml +++ b/pkg/templates/aws/resources/target_group.yaml @@ -3,14 +3,14 @@ display_name: Target Group sanitize_name: # https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateTargetGroup.html # This name must be unique per region per account, - # can have a maximum of 32 characters, + # can have a maximum of 32 characters (24 since we reserve 8 for an IaC-appended suffix), # must contain only alphanumeric characters or hyphens, # and must not begin or end with a hyphen. | {{ . | replace `[^[:alnum:]-]+` "-" | replace `(^-)|(-$)` "" - | length 1 32 + | length 1 24 }} properties: