If you
- Create a CloudFormation template that creates an Auto Scale Group
- Set the
TargetGroupARNsfield in the Auto Scale Group to the output from the Target Group'sLoadBalancerArnsattribute (which is obtained withGetAtt) - Do a stack update
You will encounter a stack update failure with the error message Provided Target Groups may not be valid
Instead of using GetAtt of the LoadBalancerArns of the Target Group,
use the Ref of the Target Group and put the single resulting ARN into
a list when you set the TargetGroupARNs in the Auto Scale Group
AWSTemplateFormatVersion: "2010-09-09"
Resources:
TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
Port: 443
Protocol: HTTP
VpcId: !Ref VpcId
AutoScaleGroup:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
LaunchConfigurationName: !Ref LaunchConfiguration
TargetGroupARNs: !GetAtt TargetGroup.LoadBalancerArnsAWSTemplateFormatVersion: "2010-09-09"
Resources:
TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
Port: 443
Protocol: HTTP
VpcId: !Ref VpcId
AutoScaleGroup:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
LaunchConfigurationName: !Ref LaunchConfiguration
TargetGroupARNs:
- !Ref TargetGroup