From de835def821374fbdcd297a815853b8bf028a7f1 Mon Sep 17 00:00:00 2001 From: roleyfoley Date: Thu, 2 Nov 2023 12:35:59 +1100 Subject: [PATCH] feat: instance type support for lb --- aws/components/lb/setup.ftl | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/aws/components/lb/setup.ftl b/aws/components/lb/setup.ftl index b34afe04..dee85574 100644 --- a/aws/components/lb/setup.ftl +++ b/aws/components/lb/setup.ftl @@ -260,14 +260,27 @@ [#case EC2_COMPONENT_TYPE] [#list linkTargetResources["Zones"] as zone, resources ] - [#if getExistingReference(resources["ec2ENI"].Id, IP_ADDRESS_ATTRIBUTE_TYPE)?has_content ] - [#local staticTargets += - getTargetGroupTarget( - "ip", - getExistingReference(resources["ec2ENI"].Id, IP_ADDRESS_ATTRIBUTE_TYPE), - port.Port, - false - )] + [#if solution.TargetType == "ip" ] + [#if getExistingReference(resources["ec2ENI"].Id, IP_ADDRESS_ATTRIBUTE_TYPE)?has_content ] + [#local staticTargets += + getTargetGroupTarget( + "ip", + getExistingReference(resources["ec2ENI"].Id, IP_ADDRESS_ATTRIBUTE_TYPE), + port.Port, + false + )] + [/#if] + + [#elseif solution.TargetType == "instance" ] + [#if getExistingReference(resources["ec2Instance"].Id)?has_content ] + [#local staticTargets += + getTargetGroupTarget( + "instance", + getExistingReference(resources["ec2Instance"].Id), + port.Port, + false + )] + [/#if] [/#if] [/#list] [#break]