diff --git a/aws/components/lb/setup.ftl b/aws/components/lb/setup.ftl index dee85574..ddce85b6 100644 --- a/aws/components/lb/setup.ftl +++ b/aws/components/lb/setup.ftl @@ -1005,14 +1005,26 @@ [#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), - destinationPort.Port, - false - )] + [#if solution.Forward.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), + destinationPort.Port, + false + )] + [/#if] + [#elseif solution.Forward.TargetType == "instance" ] + [#if getExistingReference(resources["ec2Instance"].Id)?has_content ] + [#local staticTargets += + getTargetGroupTarget( + "instance", + getExistingReference(resources["ec2Instance"].Id), + destinationPort.Port, + false + )] + [/#if] [/#if] [/#list] [#break]