I am trying to create a AWS::ElasticLoadBalancingV2::TargetGroup that accepts Target as parameters as template below :
FETargetGroup:
Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
Properties:
Name: !Sub 'targetgroup-ccp-fe-${EnvironmentName}'
Port: 443
Protocol: HTTPS
TargetType: ip
Targets:
- Id: !Select[0,!Split [",", !Ref TargetGroupIPs]]
- Id: !Select[1,!Split [",", !Ref TargetGroupIPs]]
VpcId: !Ref VPC
And the Parameter :
TargetGroupIPs:
Description: IPs to be included in Target Group
Type: String
The problem here this is static to 2 IPs, I want it to accept x number of IPs. Ex :
FETargetGroup:
Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
Properties:
Name: !Sub 'targetgroup-ccp-fe-${EnvironmentName}'
Port: 443
Protocol: HTTPS
TargetType: ip
Targets: !Split [",", !Ref TargetGroupIPs]
VpcId: !Ref VPC
But I Get validation error: Target accepts List of Objects. How it can be done correctly ?