<pre><code>Resources:                                                                                                                                                                                  
    TargetGroup:                                                                                                                                                                              
        Type: AWS::ElasticLoadBalancingV2::TargetGroup                                                                                                                                        
        Properties:                                                                                                                                                                           
          VpcId:                                                                                                                                                                              
            Fn::ImportValue:                                                                                                                                                                  
              !Sub "${Prefix}-VpcId"                                                                                                                                                          
          TargetType: instance                                                                                                                                                                
          Port: 443                                                                                                                                                                           
          Protocol: HTTPS                                                                                                                                                                     
    AutoScalingGroup:                                                                                                                                                                         
        Type: AWS::AutoScaling::AutoScalingGroup                                                                                                                                              
        Properties:                                                                                                                                                                           
          AutoScalingGroupName: Autoscaling Group Alpha                                                                                                                                       
          Cooldown: "120"                                                                                                                                                                     
          DesiredCapacity: "1"                                                                                                                                                                
          LaunchConfigurationName: AlphaLaunchConfiguration                                                                                                                                   
          MaxSize: "1"                                                                                                                                                                        
          MinSize: "1"                                                                                                                                                                        
          Tags:                                                                                                                                                                               
            -                                                                                                                                                                                 
              Key: Name                                                                                                                                                                       
              Value: Alpha ASG                                                                                                                                                                
              PropagateAtLaunch: true                                                                                                                                                         
          TargetGroupARNs:                                                                                                                                                                    
            - Ref: TargetGroup
</code></pre>

<p>As the error message states, TargetGroupARNs value should be of type List.
<a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-targetgrouparns" rel="nofollow noreferrer">https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-targetgrouparns</a></p>

CC BY-SA 4.0
2019-12-23T09:49:24.410Z
2019-12-23T09:49:24.410Z
vissree
<p>Changing the value of &quot;TargetGroupARNs:&quot; from &quot;Ref: TargetGroup&quot; to &quot;- !Ref TargetGroup&quot; should solve
the problem.</p>
<p>Reference :<a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html</a></p>

CC BY-SA 4.0
2021-07-08T18:24:03.357Z
2021-07-08T20:48:24.363Z
2021-07-08T20:48:24.363Z
Kunal
<p>I am trying to use cloudformation to setup a ASG and I have a target group which I would like to associate with the ASG. The target group is created okay but when I go to attach it to the ASG I get an error message. I'd like to be able to attach this as I want a ALB in front of the ASG</p>

<p>Error message:</p>

<pre><code>Value of property TargetGroupARNs must be of type List of String
</code></pre>

<p>Cloudformation code</p>

<pre><code>TargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      VpcId: 
        Fn::ImportValue: 
          !Sub "${Prefix}-VpcId"
      TargetType: instance
      Port: 443
      Protocol: HTTPS
AutoScalingGroup:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      AutoScalingGroupName: Autoscaling Group Alpha
      Cooldown: 120
      DesiredCapacity: 1
      LaunchConfigurationName: AlphaLaunchConfiguration
      MaxSize: 1
      MinSize: 1
      Tags:
        - 
          Key: Name
          Value: Alpha ASG
          PropagateAtLaunch: 'true'
      TargetGroupARNs:
        Ref: TargetGroup
</code></pre>

CC BY-SA 4.0
2019-12-20T11:42:49.510Z
Did you solve the issue? It seems that `TargetGroupARNs` is neither a `List` or `String`.
030
<autoscaling><aws-cloudformation>
Cloudformation issue with target groups and ASG
joshk132
# Cloudformation issue with target groups and ASG

(Asked by: username_0 on 2019-10-24)

I am trying to use cloudformation to setup a ASG and I have a target group which I would like to associate with the ASG. The target group is created okay but when I go to attach it to the ASG I get an error message. I'd like to be able to attach this as I want a ALB in front of the ASG
Error message:
Value of property TargetGroupARNs must be of type List of String

Cloudformation code
TargetGroup:
    Type: AWS::ElasticLoadBalancingV2::TargetGroup
    Properties:
      VpcId: 
        Fn::ImportValue: 
          !Sub "${Prefix}-VpcId"
      TargetType: instance
      Port: 443
      Protocol: HTTPS
AutoScalingGroup:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      AutoScalingGroupName: Autoscaling Group Alpha
      Cooldown: 120
      DesiredCapacity: 1
      LaunchConfigurationName: AlphaLaunchConfiguration
      MaxSize: 1
      MinSize: 1
      Tags:
        - 
          Key: Name
          Value: Alpha ASG
          PropagateAtLaunch: 'true'
      TargetGroupARNs:
        Ref: TargetGroup

**Tags:** autoscaling, aws-cloudformation

> **Comments:**
> **username_1**: Did you solve the issue? It seems that `TargetGroupARNs` is neither a `List` or `String`.  

---

## 2 answers

### Answer by username_2 on 2019-12-23. Score: 2

Resources:                                                                                                                                                                                  
    TargetGroup:                                                                                                                                                                              
        Type: AWS::ElasticLoadBalancingV2::TargetGroup                                                                                                                                        
        Properties:                                                                                                                                                                           
          VpcId:                                                                                                                                                                              
            Fn::ImportValue:                                                                                                                                                                  
              !Sub "${Prefix}-VpcId"                                                                                                                                                          
          TargetType: instance                                                                                                                                                                
          Port: 443                                                                                                                                                                           
          Protocol: HTTPS                                                                                                                                                                     
    AutoScalingGroup:                                                                                                                                                                         
        Type: AWS::AutoScaling::AutoScalingGroup                                                                                                                                              
        Properties:                                                                                                                                                                           
          AutoScalingGroupName: Autoscaling Group Alpha                                                                                                                                       
          Cooldown: "120"                                                                                                                                                                     
          DesiredCapacity: "1"                                                                                                                                                                
          LaunchConfigurationName: AlphaLaunchConfiguration                                                                                                                                   
          MaxSize: "1"                                                                                                                                                                        
          MinSize: "1"                                                                                                                                                                        
          Tags:                                                                                                                                                                               
            -                                                                                                                                                                                 
              Key: Name                                                                                                                                                                       
              Value: Alpha ASG                                                                                                                                                                
              PropagateAtLaunch: true                                                                                                                                                         
          TargetGroupARNs:                                                                                                                                                                    
            - Ref: TargetGroup

As the error message states, TargetGroupARNs value should be of type List.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-targetgrouparns


---

### Answer by username_3 on 2021-07-08. Score: 0

Changing the value of "TargetGroupARNs:" from "Ref: TargetGroup" to "- !Ref TargetGroup" should solve
the problem.

Reference :<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html>


---

